About CreateMutable Binding in Global Environment Record

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

  1. Let DclRec be envRec.[[DeclarativeRecord]].
  2. . If ! DclRec.HasBinding(N) is true, throw a TypeError exception.
  3. 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 ?

Link -> ECMAScript® 2025 Language Specification (tc39.es)

! in the algorithms does not mean negation. It's short hand for ReturnIfAbrupt`:

https://tc39.es/ecma262/multipage/notational-conventions.html#sec-returnifabrupt-shorthands

I will admit my brain does struggle with this syntax after so much conditioning to interpret it as a NOT, but gets easier after a while

Oh sure thanks for the help