QuestenaՎարժանք, որը ցույց է տալիս՝ ինչ կրկնել հաջորդիվ
Հարց 86

Which statement correctly relates a const binding's scope to an ordinary block?

  1. const is accessible throughout the whole program
  2. const is accessible in its block and nested scopesՃիշտ պատասխան
  3. const is always scoped to the nearest function
  4. const is accessible only while its initializer runs

Բացատրություն

A const declaration is lexical and therefore belongs to the block containing it, including nested scopes. Its special restriction concerns rebinding, not a wider scope, so const does not become function-scoped merely because its value cannot be reassigned.

Շարունակեք այս թեստով

Սկսել վարժանքը
Հարց 86: Which statement correctly relates a const binding's scope… · JavaScript Fundamentals · Questena