13.10 Relational Operators
The result of evaluating a relational operator is always of type Boolean, reflecting whether the relationship named by the operator holds between its two operands.
Syntax
The [In] grammar parameter is needed to avoid confusing the in
operator in a relational expression with the in
operator in a for
statement.
13.10.1 Runtime Semantics: Evaluation
- Let lref be ?
Evaluation ofRelationalExpression . - Let lval be ?
GetValue (lref). - Let rref be ?
Evaluation ofShiftExpression . - Let rval be ?
GetValue (rref). - Let r be ?
IsLessThan (lval, rval,true ). - If r is
undefined , returnfalse . Otherwise, return r.
- Let lref be ?
Evaluation ofRelationalExpression . - Let lval be ?
GetValue (lref). - Let rref be ?
Evaluation ofShiftExpression . - Let rval be ?
GetValue (rref). - Let r be ?
IsLessThan (rval, lval,false ). - If r is
undefined , returnfalse . Otherwise, return r.
- Let lref be ?
Evaluation ofRelationalExpression . - Let lval be ?
GetValue (lref). - Let rref be ?
Evaluation ofShiftExpression . - Let rval be ?
GetValue (rref). - Let r be ?
IsLessThan (rval, lval,false ). - If r is either
true orundefined , returnfalse . Otherwise, returntrue .
- Let lref be ?
Evaluation ofRelationalExpression . - Let lval be ?
GetValue (lref). - Let rref be ?
Evaluation ofShiftExpression . - Let rval be ?
GetValue (rref). - Let r be ?
IsLessThan (lval, rval,true ). - If r is either
true orundefined , returnfalse . Otherwise, returntrue .
- Let lref be ?
Evaluation ofRelationalExpression . - Let lval be ?
GetValue (lref). - Let rref be ?
Evaluation ofShiftExpression . - Let rval be ?
GetValue (rref). - Return ?
InstanceofOperator (lval, rval).
- Let lref be ?
Evaluation ofRelationalExpression . - Let lval be ?
GetValue (lref). - Let rref be ?
Evaluation ofShiftExpression . - Let rval be ?
GetValue (rref). - If rval
is not an Object , throw aTypeError exception. - Return ?
HasProperty (rval, ?ToPropertyKey (lval)).
- Let privateIdentifier be the
StringValue ofPrivateIdentifier . - Let rref be ?
Evaluation ofShiftExpression . - Let rval be ?
GetValue (rref). - If rval
is not an Object , throw aTypeError exception. - Let privateEnv be the
running execution context 's PrivateEnvironment. - Let privateName be
ResolvePrivateIdentifier (privateEnv, privateIdentifier). - If
PrivateElementFind (rval, privateName) is notempty , returntrue . - Return
false .
13.10.2 InstanceofOperator ( V, target )
The abstract operation InstanceofOperator takes arguments V (an
- If target
is not an Object , throw aTypeError exception. - Let instOfHandler be ?
GetMethod (target,@@hasInstance ). - If instOfHandler is not
undefined , then - If
IsCallable (target) isfalse , throw aTypeError exception. - Return ?
OrdinaryHasInstance (target, V).
Steps instanceof
operator semantics. If an object does not define or inherit instanceof
semantics.