LoginSignup
3
2

More than 5 years have passed since last update.

ES6 for in for ofにハマる

Last updated at Posted at 2017-08-22

es6からbabel-loaderでコンパイルしたらハマったので、そんな方の助けになれば。

es5
for (key in this.scores) {
    console.log(key);
}
es6
for (let key in this.scores) {
    console.log(key);
}
es6
for (let value of this.scores) {
    console.log(value);
}
3
2
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
3
2