Skip to content

Commit f8fe974

Browse files
committed
translate "Using 'hasOwnProperty' for Filtering" in "Object" to ja
1 parent 04b6f1c commit f8fe974

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

‎doc/ja/object/forinloop.md‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,21 @@
1818
> **注意:** `for in`は常にプロトタイプチェーンを完全に遡ります。これにより
1919
> オブジェクトに追加されている継承が多ければ多い程、速度は遅くなります。
2020
21-
### `hasOwnProperty` for Filtering
21+
### `hasOwnProperty`をフィルタリングに使用する
2222

23-
// still the foo from above
23+
// 継承されているfoo
2424
for(var i in foo) {
2525
if (foo.hasOwnProperty(i)) {
2626
console.log(i);
2727
}
2828
}
2929

30-
This version is the only correct one to use. Due to the use of `hasOwnProperty` it
31-
will **only** print out `moo`. When `hasOwnProperty` is left out, the code is
32-
prone to errors in cases where the native prototypes - e.g. `Object.prototype` -
33-
have been extended.
30+
このループの唯一正しい使い方がこの方法です。`hasOwnProperty`を使用しているので、
31+
`moo`**のみ**が表示されるようになります。`hasOwnProperty`が省略されている場合は、このコードは
32+
組み込みのプロトタイプが存在する場合に(特に`Object.prototype`が拡張されている場合)エラーを発生しやすくなります。
3433

35-
One widely used framework which does this is [Prototype][1]. When this
36-
framework is included, `for in` loops that do not use `hasOwnProperty` are
37-
guaranteed to break.
34+
一般に広く使用されているJavaScriptフレームワークとして[Prototype][1]が挙げられます。このフレームワークには、
35+
`for in` 内で`hasOwnProperty`が使用されプロトタプチェーン内を頭まで遡るのを中断する事が保証されています。
3836

3937
### In Conclusion
4038

0 commit comments

Comments
 (0)