Usage of JS two parentheses () ()

Source: Internet
Author: User

Implement a function FN, so that the result of FN (1) (2) is two parameters of the and, at first did not react, in fact, carefully think of the second parenthesis is the function of the question of re-call, nonsense not to say, the code:

varfn =function(n) {functionF (m) {returnn +m; }        returnf;//This must return the entire function, not the function's call F (); }; vars = fn (1) (2); Console.log (s);//or functionFN (n) {functionF (m) {returnn +m; }        returnF; }; vars = fn (1) (2); Console.log (s);
If that's the case, it's an internal function problem.
var a = function (n) {function f () {return n + N;} return f ();
}; var s = a (1); Console.log (s);

The difference is that the first is a variable function, the call must be after the function definition, and the second FN () can be called before and after the function.

Usage of JS two parentheses () ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.