0
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 1 year has passed since last update.

JavaScriptのクロージャについて(自分のための備忘録)

Posted at

◆クロージャとは
 関数とその中に同封された関数の「外」にある変数の組み合わせ。
 (関数とその関数が宣言された環境を合わせて指すプログラム用語。)

◆クロージャはなぜ重要?どのように使われる?
 ・関数のバリエーションを作るのに便利。
 ・関数内で使用される変数や定数を外から変更されたくない時に使える。

◆クロージャの例
 const root = x => {
  return y => y ** (1/x);
 }

 const root2 = root(2);
 console.log(root(4)); // -> 2

0
0
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
0
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?