A.S.: The question pertains to the type of error rather than the phenomenon itself
"use strict"
results in a TypeError when system variables like NaN
and undefined
are modified.
But why is it categorized as a TypeError instead of a SyntaxError?
Edit: In reality, this is not a SyntaxError because there are no syntax errors in the code snippet.
The actual issue lies in the fact that certain protected objects cannot be altered manually; therefore, it could be considered an AccessError although such designation does not officially exist.
So, why do access-errors manifest similarly to type-errors?