Why does [1,2] + [3,4] become "1,23,4" in JavaScript?

Asked 2 years ago, Updated 2 years ago, 41 views

To add elements to an array, as in the title, If you calculate [1,2] + [3,4], the result will be "1,23,4" why is that?

javascript array string

2022-09-21 20:59

1 Answers

from an array of + operators are not defined .. So they converted to JavaScript, the array of string seems to us that the operation.


2022-09-21 20:59

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.