Typeof: Difference between revisions

From triplescripts.org wiki
Content added Content deleted
(Created page with "The triple script dialect includes <code>typeof</code> expressions. Unlike ECMA-262, <code>typeof</code> the righthand side must be parenthesized. E.g. <code>typ...")
 
m (grammar)
Line 1: Line 1:
The [[dialect|triple script dialect]] includes <code>typeof</code> expressions.
The [[dialect|triple script dialect]] includes <code>typeof</code> expressions.


Unlike ECMA-262, <code>typeof</code> the righthand side must be parenthesized. E.g. <code>typeof <var>foo</var></code> is an error, but <code>typeof(<var>foo</var>)</code> is not.
Unlike ECMA-262, when using <code>typeof</code> the righthand side must be parenthesized. E.g. <code>typeof <var>foo</var></code> is an error, but <code>typeof(<var>foo</var>)</code> is not.


NB: The result of a <code>typeof</code> expression is a string, and there is no need to use [[triple equals]] when checking the result. In fact, <strong>it is an error to check a <code>typeof</code> expression with triple equals</strong>.
NB: The result of a <code>typeof</code> expression is a string, and there is no need to use [[triple equals]] when checking the result. In fact, <strong>it is an error to check a <code>typeof</code> expression with triple equals</strong>.

Revision as of 19:42, 22 June 2020

The triple script dialect includes typeof expressions.

Unlike ECMA-262, when using typeof the righthand side must be parenthesized. E.g. typeof foo is an error, but typeof(foo) is not.

NB: The result of a typeof expression is a string, and there is no need to use triple equals when checking the result. In fact, it is an error to check a typeof expression with triple equals.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.