Chrome Version: 59.0.3064.0 (Official Build) canary (64-bit) (cohort: 64-Bit)
OS: Win 8.1
What steps will reproduce the problem?
(1) Run the following JavaScript (in Dev Console, or load attached):
function(t){console.log(t);}.bind(null,3)();
What is the expected result? Console outputs "3".
What happens instead? The following error:
Uncaught SyntaxError: Unexpected token (
Please use labels and text to provide additional information.
If we try the following:
(A) Assign an LVALUE:
result = function(t){console.log(t);}.bind(null,3)();
(B) Put () around function:
(function(t){console.log(t);}).bind(null,3)();
(C) Put () around bind function
(function(t){console.log(t);}.bind)(null,3)();
Then this correctly prints 3 and evaluates undefined.
Since (A) is commonly used, it's rather surprising that without an LVALUE the parser fails.
|
Deleted:
test.html
191 bytes
|
Comment 1 by hua...@chromium.org
, Apr 7 2017