FrontendDeveloper.in

JavaScript question detail

What happens if we add two arrays

If you add two arrays together, it will convert them both to strings and concatenate them. For example, the result of adding arrays would be as below,

console.log(["a"] + ["b"]); // "ab"
console.log([] + []); // ""
console.log(![] + []); // "false", because ![] returns false.
Back to all JavaScript questions
Get LinkedIn Premium at Rs 399