Can someone explain me examples of how this algorithm works?
GetValue (V)# 1. ReturnIfAbrupt(V). 2. If Type(V) is not Reference, return V. 3. Let base be GetBase(V). 4. If IsUnresolvableReference(V) is true, throw a ReferenceError exception. 5. If IsPropertyReference(V) is true, then a. If HasPrimitiveBase(V) is true, then i. Assert: In this case, base will never be null or undefined. ii. Let base be ToObject(base). b. Return ? base.[[Get]](GetReferencedName(V), GetThisValue(V)). 6. Else base must be an Environment Record, a. Return ? base.GetBindingValue(GetReferencedName(V), IsStrictReference(V)) (see 8.1.1).
http://www.ecma-international.org/ecma-262/7.0/#sec-getvalue
It would be nice if someone with examples explained how this works. I tried, but I did not quite understand.
Examples for explanation:
let a = 10, b = {name: "Unknown"}; (null, a); (null, a.name); (null, b); (null, b.name); (null, b.surname); (null, 10);
javascript ecmascript-6
Maximpro
source share