LoginSignup
1
0

More than 3 years have passed since last update.

【JSメモ】for, for ... in, for ... of の違い

Last updated at Posted at 2019-05-25

概要

JavaScriptにおける3種類のfor文

for

for(let i = 0; i < 10; i++){
    // 10 回ループ
}

for ... in

オブジェクトのプロパティに対するループ処理

for(let pro in object){
    // オブジェクトのプロパティに対する処理
}

for ... of

反復可能オブジェクト(Array, Map, Set, arguments)のに対するループ処理

for(let value of object){
    // オブジェクトのプロパティの値に対する処理
}

参考

公式ドキュメント

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