Квиз по JavaScript: let, const & var

This JavaScript quiz checks the three ways to declare a variable. You will predict output involving block scope, reassignment and redeclaration, and see why modern code uses const and let instead of var.

Лёгкий 10 вопроса ~5 минуты Проходной балл: 80% Node.js 22

Выберите режим

Вы играете как гость: войдите, чтобы сохранить XP и серию.

Пример вопроса

Вопрос 1 из 10

What does this print?

let x = 1;
{
  let x = 2;
}
console.log(x);
Показать ответ

B. 1 The inner let x is a new variable that only lives inside the braces. Outside the block, x is still the outer one, which holds 1.

Что проверяет этот квиз

  • Block scope with let and const
  • Function scope with var
  • Why const stops reassignment but not changes to an object
  • Redeclaring a variable with var vs let
  • var vs let in a for loop

Частые вопросы

Нужен ли аккаунт?

Нет. Играть может любой. Войдите, чтобы сохранять XP, серию, значки и историю.

Можно пройти ещё раз?

Да. Лучший результат сохраняется, а вопросы и ответы каждый раз перемешиваются.