Durai R’s Post

Console.log([1,2,3] + [4,5,6]). What is the output? 🤔 💬 Comment your answer first… then click “more” 👇 Most developers think the result is: [1,2,3,4,5,6] ❌ Nope 😏 In JavaScript the output is: "1,2,34,5,6" 💥 👉 Data type: string 👉 Why? Arrays convert to strings before using +. Then JavaScript concatenates the strings. 🔥 Rule: + with arrays → string concatenation Did you guess the correct output and data type? 😄 #javascript #codingtips #programming #developer #webdev #100daysofcode

To view or add a comment, sign in

Explore content categories