Skip to content
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

ES2020: for-in mechanics #1180

Closed
2 tasks done
azu opened this issue Jun 20, 2020 · 1 comment · Fixed by #1194
Closed
2 tasks done

ES2020: for-in mechanics #1180

azu opened this issue Jun 20, 2020 · 1 comment · Fixed by #1194

Comments

@azu
Copy link
Collaborator

azu commented Jun 20, 2020

for...in文はオブジェクトのプロパティに対して、順不同で反復処理を行います。
https://jsprimer.net/basic/loop/#for-in-statement

これが仕様で定義されるようになったので、順不同でとすればOKそう。
footerでES2020で順番が定義されたことについて追加する

他にもkeysとかReflectとかあるけど言及はしていないはず

ES2020でfor...in文の列挙順が規程された。これまでは実装依存だったけど、Reflect.ownKeys(ES2015)が入った際に大体の実装が同じ列挙順に統一されたため、仕様が修正された。

Proxyについての列挙順など細かい問題は残ってる

やること

@azu azu mentioned this issue Jun 20, 2020
12 tasks
@azu azu self-assigned this Jun 28, 2020
@azu
Copy link
Collaborator Author

azu commented Jun 28, 2020

proposal-for-in-order/README.md at master · tc39/proposal-for-in-order
細かい解説

for non-integer properties, properties are returned in insertion order
properties which are added to the base object being iterated after iteration begins are not returned

4は知らなかったなー

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant