Primary expression (Definition)

Primary expressions are used with operators to form more complex expression types.

Availability:

ECMAScript edition - 2

A primary expression is one that needs no further evaluation to resolve its value.

A primary expression is a specific object, identifier, or literal and may also be the result of evaluating another nested expression that is surrounded by the grouping operators (parentheses).

The this keyword is classed as a primary expression. The value returned by the this keyword depends on the execution context currently being processed.

An identifier is a primary expression if it refers to an object or function.

Constants and string literals are by definition primary expressions.

Any expression within the grouping operators (parentheses) becomes a primary expressions since the rules of precedence dictate that it must be resolved completely before being replaced into the expression to which it is an operand.

An identifier is evaluated according to the current scoping rules presently in force. This would return an internal reference value inside the interpreter but this would be transparent to the user.

Literal values of the following types are considered to be primary expressions:

Expressions can be evaluated in the desired order by using the grouping operator or parentheses to nest the expressions. This allows the delete and typeof operations to be applied to expressions.

See also:Constant, Execution context, Expression, Grouping operator ( ), Identifier resolution, Literal, Operator Precedence, this

Cross-references:

ECMA 262 edition 2 - section - 7.7

ECMA 262 edition 2 - section - 10.1.4

ECMA 262 edition 2 - section - 11.1

ECMA 262 edition 3 - section - 10.1.4

ECMA 262 edition 3 - section - 11.1