Home > Web Front-end > JS Tutorial > body text

Introduction to immediate execution function expressions in JavaScript_javascript skills

WBOY
Release: 2016-05-16 16:09:11
Original
1613 people have browsed it

We are used to seeing this anonymous function

Copy code The code is as follows:

(function(){
console.log("test");
})();

What I have been calling before is self-executing anonymous function

I found out that there is another name: Immediately-Invoked Function Expression (IIFE, Immediately-Invoked Function Expression)

Call function expression immediately

Compared with self-executing anonymous functions, the meaning of immediately calling function expressions is clearer.

Self-executing functions include the following examples:

Copy code The code is as follows:

function foo() { foo(); }

and
Copy code The code is as follows:

var foo = function() { arguments.callee(); };

More importantly, something like the following might be a self-executing anonymous function
Copy code The code is as follows:

var foo = function() { foo(); };
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template