+ 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?

18th Jun 2019, 9:05 AM
Fabien First
Fabien First - avatar
1 Antwort
+ 1
Because it is String. [1,2]+[3,4] === "1,23,4" //true "1,23,4".length is 6.
8th Sep 2019, 12:54 PM
mar