Member-only story

7 Simple JavaScript Interview Questions That Blew My Mind

habtesoft
3 min readOct 15, 2024

--

Sometimes, it’s not the complexity of the question but the subtleties that trip you up. JavaScript, with its quirks and flexibility, often presents challenges that seem simple on the surface but reveal deeper intricacies. Here are seven seemingly simple JavaScript interview questions that might catch you off guard — just like they did to me.

Not a Medium member? Read this article here

1. What’s the difference between == and ===?

This question seems basic, but it’s a foundational concept in JavaScript. The difference between == (loose equality) and === (strict equality) can cause some confusion, especially due to type coercion.

  • == compares two values after performing type conversion.
  • === compares values without type conversion.
console.log(1 == '1'); // true (type conversion happens)
console.log(1 === '1'); // false (strict comparison)

Mind-blowing moment: Understanding that == can lead to unexpected results due to JavaScript's type coercion.

2. What is the output of [] + [] and [] + {}?

These types of questions test your knowledge of JavaScript’s implicit type coercion and how operators…

--

--

habtesoft
habtesoft

Written by habtesoft

Passionate JavaScript developer with a focus on backend technologies. Always eager to connect and learn. Let’s talk, https://buymeacoffee.com/habtesoftat

No responses yet