Skip to main content
⏱ 0:00est. 2 min

Chapter 62- Dangerous Aside (Arrays and for ..in)

Notes​

Example 1 :
Array.prototype.myCustomFeature = β€˜cool';
var arr = [β€˜John, 'Jane', 'Jim'];
for(var prop in arr){
console.log(prop + ":" + arr[prop]);
}
//OUTPUT For in can read all properties of an array to avoid this always use for loop
0 : John
1 : Jane
2 : Jim
myCustomFeature : cool