← 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?
- A.It is slower than let
- B.It ignores block scope, which causes surprising bugs
- C.It cannot store numbers
- 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 →