Illustration 1:
Let numbers = [4,5,6] + 2;
console.log(numbers) // "4,5,62"
typeof numbers // String
Illustration 2:
let nums = 10 + ["w","o","r","l","d"];
console.log(nums) // "10w,o,r,l,d";
typeof nums // String
When combining a number or string with an array using the plus operator, the result is a concatenated string where the number/string gets appended to the existing elements of the array. This might seem unusual, so let's delve into what exactly is happening in these scenarios.