Normalize application of `typeof` operator

Consistently use the `typeof` operator without the grouping operator
(and include one explicit test to ensure the validity of this pattern
generally).
This commit is contained in:
Mike Pennisi 2015-04-07 17:34:19 -04:00
parent 3dce857e32
commit 29326da2a8
2 changed files with 10 additions and 4 deletions

View File

@ -11,13 +11,13 @@ description: Checking types of parseInt and Math.exp
---*/
assert.sameValue(
typeof(Math.exp),
typeof Math.exp,
"function",
'#1: typeof(Math.exp)!=="function" '+typeof(Math.exp)
'#1: typeof Math.exp!=="function" '+typeof Math.exp
);
assert.sameValue(
typeof(parseInt),
typeof parseInt,
"function",
'#2: typeof(parseInt)!=="function" '+typeof(parseInt)
'#2: typeof parseInt!=="function" '+typeof parseInt
);

View File

@ -69,3 +69,9 @@ assert.sameValue(
"number",
'#10: var x = 0; typeof\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029x; x === "number". Actual: ' + (x)
);
assert.sameValue(
eval("typeof(0)"),
"number",
'applied with grouping operator enclosing operand'
);