Skip to content

Commit 066a7f2

Browse files
author
Vlad Esin
authored
Example of inherited fields (for...in arr) (#14)
1 parent 939cbfc commit 066a7f2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

JavaScript/5-for-in-array.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Object.defineProperty(numbers, 'newField', {
1010
value: 'valueOfNewField',
1111
});
1212

13+
Object.prototype.inheritedProperty = 'inherited';
14+
1315
for (const i in numbers) {
1416
const value = numbers[i];
1517
console.log(i, typeof i, value);

0 commit comments

Comments
 (0)