-
-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(loop): for...of文について #95
Conversation
サロゲートペアも考慮し1文字ずつ値を列挙することができます。 | ||
|
||
```js | ||
var string = "吉野家"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"吉野家" じゃない サロゲートペアな文字列欲しい(短めで意味があり、サロゲートペアの例としてよくあがり、商標とかではないもの)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
𩸽 (ホッケ)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"𩸽定食"
https://twitter.com/teppeis/status/755583070175055872
"🍣🍵🍡 (U+1F363 U+1F375 U+1F361)"
https://twitter.com/nanto_vi/status/755583839355887616
"𠀋一郎"
https://twitter.com/tgfjt/status/755585245475241985
𠮷野家はやっぱり強いので、𩸽 (ホッケ)にするかどうかは #96 のMTGに持ち越します。 |
実はすでにiterableオブジェクトは登場していて、Arrayはiterableオブジェクトです。 | ||
|
||
次のようにfor...of文で、配列から値を取り出し反復処理を行うことができます。 | ||
for...in文とは異なり、添字ではなく値を列挙します。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
添字とindexとindex値 迷ってる気がする。
添字だと値っぽい感じがしない
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
添字って聞くと表記法って印象があるけどそうでもないのかな
} | ||
console.log(total); // => 1 | ||
``` | ||
[import, for-in-array-bug-example.js](./src/for-in/for-in-array-bug-example.js) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for-inの例普通に間違ってた。
サンプルコードを外部ファイルにしてテストを追加した
loopの節のサンプルコードを外部ファイルにしてテストを追加していってます。 |
テストをそれぞれ追加
close #68