+ 1
about array in js
Please someone help me, var num1=[1,2]; var num2=[3,4]; the output of(num1+num2) is an array with four elements(1,2,3,4), but why the length is 6?
1 Resposta
+ 1
Because it is String.
[1,2]+[3,4] === "1,23,4" //true
"1,23,4".length is 6.