0
Could someone please explain this JavaScript answer?
This was a question in a JavaScript challenge quiz: What is the output of this code? var name1 = "John"; var name2 = "Sebastian"; console.log(name1.length + "" + name2.length); I am thinking the answer would be 13...however the answer was 49. Why? Could someone please explain?
3 Respuestas
0
Ah, I see. Thank you!
0
john = 4
Sebastian = 9
as thy are string so 4+9 = 49
its just string function hope you get it
- 2
it is using your value as a string and performing concatenation function