+ 4
I don't understand length resulting from 2 set objects sum
Why by adding two objects with length 2 each one, the length of the result is 6, shouldn't it be 3? var nums1 = [1,2]; // length is 2 var nums2 = [3,4]; // length is 2 too var set = nums1 + nums2; //set is [1,23,4] console.log(set.length) // output is 6! why?? Enviar comentarios Historial Guardadas Comunidad
2 Réponses
+ 8
when you add nums1 and nums2 then it becomes string "1,23,4" not array so the length of this string is 6 (including commas)
+ 3
Now I see!! Thanks a lot VEDANG!!