Questenaتدريب يوضح لك ما ينبغي مراجعته لاحقًا
السؤال 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 reassignedالإجابة الصحيحة
  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

الشرح

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.

تابع هذا الاختبار

بدء التدريب
السؤال 89: After const rate = 3 has initialized successfully, the same… · JavaScript Fundamentals · Questena