1
0

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 3 years have passed since last update.

JavaScript 関数定義

Last updated at Posted at 2019-12-03

#関数(メソッド)の定義

function 関数名(){
 //行う処理
}

変数有り版

function 関数名(引数A){
 console.log(引数A);
}

let sample = "事件ですよ"

関数名sample;

定義した変数と呼び出す際に使う引数は同名
引数として渡された引数Aと行う処理に渡す引数は同名

#無名関数

let sample = function(){
    console.log('元気ですか?');
}

sample();  //元気ですか?が出力

function()で関数名が無いので無名関数となっております。
他の値を代入し易く、使い勝手が良いです
 

1
0
1

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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?