Hi everone :) !
Currently Reading April 2024 version,
So I am new to reading ecmascript, and was going through ER (environment records), i was reading the GER( Global Enviroment Record) (9.1.1.4.2) ~ createMutableBinding.
The method createMutableBindingwhich is implemented in GER has following steps
- Let DclRec be envRec.[[DeclarativeRecord]].
- . If ! DclRec.HasBinding(N) is true, throw a TypeError exception.
- Return ! DclRec.CreateMutableBinding(N, D).
Why is ecma suggesting to throw type error ? if DclRecord doesnt get binding ?
The function is createmutable Record, shouldnt it be actually be like this, if declHasBinding (n) true , then type error ?
Why is ! operator here ? Can someone please clarify these steps ?