Talking about JavaScript calling function expression immediately

Source: Internet
Author: User
function declaration, function expression, anonymous function: function declaration: Functions fnname () {...}; Declare a function using the function keyword, and then specify a name for the functions, called the function declaration. function expression var fnname = function () {...}; Declaring a function with the function keyword, but not naming it, and finally assigning an anonymous function to a variable called a function expression, is the most common form of function expression syntax. Anonymous functions: Function () {}; Declaring a function using the functions keyword, but not naming the function, so called anonymous functions, anonymous functions are function expressions, anonymous functions have many functions, assigning a variable to create a function, assigning an event to an event handler or creating a closure, and so on. function declarations and function expressions differ in that the JavaScript engine parses the JavaScript code with a function declaration (function declaration hoisting) on the current execution environment (scope), The function expression must wait until the JAVASCIRTP engine executes to its row to parse the function expression from the top and the next line, and the function expression can be called immediately after it is appended with parentheses, and the function declaration cannot be called only in the form of FnName ().

Talking about JavaScript calling function expression immediately

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.