I was writing about version news and I came across something that I think is a bug in javascript. The code:
const arrValor = [1,2,3,4,5,,6,[7,8,9,[10,11,[111,222]],12],13,14];
//console.log("Original :",arrValor);
console.log("mas s :",arrValor.flatMap(val=>val+"s"));
the result:
mas s : [
'1s',
'2s',
'3s',
'4s',
'5s',
'6s',
'7,8,9,10,11,111,222,12s',
'13s',
'14s'
]
The detail is in the 12, since it is at the same level as the 7,8,9 and to those it does not add the s... Why to the 12?
Test with Node v18.13.0 en windows 10Pro 21H2
I expected the layered application to be homogeneous, and I have tried mixed numeric and alphabetic arrays, but it always behaves the same Attention editors: My question is not how to flatten an array, but a strange behavior in the function that makes me think that it does not work well, and that is what I am getting