1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Javascriptの関数の即時実行について

Last updated at Posted at 2015-05-10

Javascriptの関数は、関数を生成した直後に呼び出すことが可能。

関数式の即時実行

var sayHello = function(str){
    console.log("即時実行:" + str + "!");
}("引数");

上記の記述の場合、コンソールには「即時実行:引数!」と表示される。

無名関数の即時実行

(function(str){
    console.log("無名即時関数実行:" + str );
})("引数");

上記の記述の場合、コンソールには「無名即時関数実行:引数」と表示される。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?