Uncaught TypeError: (intermediate value)(...) is not a function
Reported by
sunagbra...@gmail.com,
Jan 29 2017
|
|||||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0
Steps to reproduce the problem:
1. call eval function with the following string:
2. (function() {})() (function() {})()
OR
3. (function() {})() var a = 123;
OR
4. (function() {
(function() {})() (function() {})()
})()
What is the expected behavior?
create two or more anonymous function to closure methods
What went wrong?
Uncaught TypeError: (intermediate value)(...) is not a function
at <anonymous>:1:19
Did this work before? N/A
Chrome version: 58.0.2996.0 Channel: canary
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: Shockwave Flash 22.0 r0
,
Jan 30 2017
,
Jan 30 2017
Reporter@ could you please provide a sample Html/.js file to reproduce the issue from TE end. Thanks..
,
Jan 30 2017
#3, simply paste "(function() {})() (function() {})()" without quotes in devtools console (Ctrl-Shift-I or F12) on a new tab page and press Enter. Same for the other samples.
,
Jan 30 2017
#3, #4, Yes! thanks wox.
,
Feb 1 2017
,
Feb 1 2017
This is working as intended.
2)
(function() {})() (function() {})()
^ function call
^------------^ function call, parameter is a function
^^ another function call
So this is the same as:
foo(param1)(param2)(param3) which means calling function foo with param1, calling whatever that returns with param2 and so on.
And now foo(param1) is not a function, thus the error.
What you probably meant is this:
(function() {})(); (function() {})()
3)
(function() {})() var a = 123;
^^^ unexpected token
This is again foo() var a; which is a syntax error.
4) Same as 2), now the foo(param1)(param2)(param3) is simply passed in as a parameter.
,
Feb 1 2017
it makes a lot of sense, thanks marja! thanks guys. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by nyerramilli@chromium.org
, Jan 29 2017