TheDocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
. (dot) operator is a property accessor that evaluates to a Reference Record pointing to a specific property on an object. It provides a statically-analyzable syntax for property resolution where the property name is an identifier known at authoring time.
Evaluation Mechanics and Reference Records
When the JavaScript engine evaluates the dot operator, it does not immediately retrieve a value, trigger internal[[Get]]/[[Set]] methods, or invoke getters. Instead, it performs the following steps to construct an internal specification type known as a Reference Record:
- Left Operand Evaluation: The engine evaluates the
Expressionon the left side. - Object Coercibility Check: If the evaluated left operand is
nullorundefined, the engine immediately throws aTypeError(RequireObjectCoercible). - Reference Record Construction: The operator returns a Reference Record containing:
- Base Value: The evaluated result of the left operand. If the operand is a primitive (e.g.,
string,number), the base value remains the primitive, and boxing (temporary coercion to a wrapper object) is deferred until the Reference Record is actually operated upon. - Referenced Name: The literal string representation of the right operand (
IdentifierNameorPrivateIdentifier). - Strict Reference Flag: A boolean indicating if the code is executing in strict mode.
- Base Value: The evaluated result of the left operand. If the operand is a primitive (e.g.,
Contextual Resolution
Because the dot operator evaluates to a Reference Record rather than a concrete value, the actual internal operations are deferred to the surrounding syntactic context:- Value Extraction (
GetValue): If the expression is used in a context expecting a value (e.g.,const x = obj.prop), the engine calls the internalGetValueoperation on the Reference Record. This triggers the[[Get]]internal method on the base object, traversing the prototype chain and invoking getter functions if the property is an accessor. - Assignment (
PutValue): If used as the left-hand side of an assignment (e.g.,obj.prop = 10), the engine callsPutValueon the Reference Record. This triggers the[[Set]]internal method, mutating an existing property or defining a new own property. - Deletion: If used with the
deleteoperator (e.g.,delete obj.prop), the engine uses the Reference Record to remove the property directly. BecauseGetValueis never called, getter functions are not invoked during deletion.
Method Invocation and this Binding
The Reference Record returned by the dot operator is critical for establishing the this context during method calls.
When a function is invoked directly from a dot property access, the engine extracts the Base Value from the Reference Record and passes it as the this binding to the function’s execution context. If the dot operator evaluated directly to the function’s value instead of a Reference Record, the base object reference would be lost, and this would default to the global object or undefined.
Lexical Grammar and Numeric Literals
The dot operator interacts specifically with JavaScript’s lexical grammar regarding numeric literals. A dot immediately following an integer literal is parsed by the engine as a decimal point for a floating-point number, not as the property accessor operator.Right Operand Constraints
The right side of the dot must be anIdentifierName or a PrivateIdentifier (which begins with a # to access private class fields).
According to the ECMAScript specification, an IdentifierName is broader than a standard identifier because it allows the use of reserved words (e.g., obj.class, obj.catch). It must begin with a Unicode character possessing the ID_Start property, an underscore (_), or a dollar sign ($). Subsequent characters must possess the ID_Continue property. Because the right operand is restricted to this syntax, the dot operator cannot be used to access properties whose keys contain spaces, hyphens, start with numbers, or are dynamically determined at runtime.
Master JavaScript with Deep Grasping Methodology!Learn More





