🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: JavaScript Basics: all 9 questions

Quiz: JavaScript Basics · Question 6 of 9

Why should you avoid var in modern JavaScript?

Why should you avoid var in modern JavaScript?

  1. A.It is slower than let
  2. B.It ignores block scope, which causes surprising bugs
  3. C.It cannot store numbers
  4. D.It is not supported in browsers
Answer & explanation

Correct answer: It ignores block scope, which causes surprising bugs

Use const by default and let when the value must change.

Can you get the rest right without peeking?

Take the timed Quiz: JavaScript Basics quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →