🧠 JavaScript Tricky Questions You Must Master for Your Next Interview! 🚀
🧠 JavaScript Tricky Questions You Must Master for Your Next Interview! 🚀 JavaScript may look friendly, but under the hood, it’s full of quirks that even experienced developers get stumped by! 😅 Whether you’re prepping for your next big tech interview or want to level up your JS brain, here are some tricky and mind-bending questions with real-world examples. 💡 Let’s dive deep! 🏊♂️ 🔥 1. What is the result of [] + [] and why? Answer: "" (an empty string) console . log ([] + []); // "" Why? When using + with arrays, JavaScript tries to convert both operands to strings and then concatenate them. []. toString (); // "" So essentially it becomes: "" + "" => "" 🤯 Mind blown? It gets crazier! 🌀 2. What is the output of [1,2,3] + [4,5,6] ? Answer: "1,2,34,5,6" console . log ([ 1 , 2 , 3 ] + [ 4 , 5 , 6 ]); // "1,2,34,5,6" JavaScript converts both arrays to strings: [ 1 , 2 , 3 ]. toString (); // ...