JavaScript Magic: 20 Quirky Quandaries! π«
Prepare to be enchanted by the mysterious world of JavaScript quirks! π§ββοΈ Let's embark on a journey through 20 mind-bending questions that will test your understanding of JavaScript's peculiar behaviors! ππ‘
Question 1: What's the result of [] + {}
? π€
console.log([] + {}); // ?
Question 2: Can you explain [] == ![]
? π§
console.log([] == ![]); // ?
Question 3: How does true + true
behave? π€
console.log(true + true); // ?
Question 4: What's the result of typeof null
? π€
console.log(typeof null); // ?
Question 5: What happens with !''
? π§
console.log(!''); // ?
Question 6: What's the output of 1 + 2 + '3'
? π€
console.log(1 + 2 + '3'); // ?
Question 7: Can you explain console.log('5' - 3)
? π§
console.log('5' - 3); // ?
Question 8: What's the result of console.log(typeof NaN)
? π€
console.log(typeof NaN); // ?
Question 9: How does console.log(1 + null)
behave? π§
console.log(1 + null); // ?
Question 10: What's the output of +'42'
? π€
console.log(+'42'); // ?
Question 11: How does console.log(undefined == null)
behave? π§
console.log(undefined == null); // ?
Question 12: What's the result of console.log('5' + 3)
? π€
console.log('5' + 3); // ?
Question 13: Can you explain console.log('5' - '2')
? π§
console.log('5' - '2'); // ?
Question 14: What's the output of console.log(0 == null)
? π€
console.log(0 == null); // ?
Question 15: How does console.log([] == ![])
behave? π§
console.log([] == ![]); // ?
Question 16: What's the result of console.log([] + null)
? π€
console.log([] + null); // ?
Question 17: What happens with console.log(false == null)
? π§
console.log(false == null); // ?
Question 18: How does console.log(1 + '2' + 3)
behave? π€
console.log(1 + '2' + 3); // ?
Question 19: What's the output of console.log([] + undefined)
? π§
console.log([] + undefined); // ?
Question 20: Lastly, what does console.log(NaN === NaN)
return? π€
console.log(NaN === NaN); // ?
π Ready to Unlock the Mysteries? π«
Put on your wizard's hat and dive into these JavaScript enchantments! Test your skills and see if you can unravel the quirks that make JavaScript both magical and perplexing! π©β¨
Currently Dev.to Markdown Parsing has errors to see answers on GitHub Gist
Top comments (0)