QuestenaPractice that shows what to review next
Question 89

After const rate = 3 has initialized successfully, the same scope executes rate = 4. What happens?

  1. A TypeError is thrown because the const binding is being reassignedCorrect answer
  2. rate becomes 4 because const controls only scope
  3. A new inner rate binding is created
  4. The assignment silently leaves rate equal to 3

Explanation

The second assignment attempts to replace the value held by a const binding, so evaluation throws a TypeError. This rule concerns rebinding the name; it should not be generalized into a claim that every object stored in const is deeply frozen.

Continue with this test

Start practice
Question 89: After const rate = 3 has initialized successfully, the same… · JavaScript Fundamentals · Questena