JSFiddle - React, Tailwind, and code Playground

JavaScript

Array.prototype.random = function() {
	return 0;
};

var test = [];

console.log("elements in test without hasOwnProperty");
for(var i in test) {
    console.log(i);
}

console.log("elements in test with hasOwnProperty");
for(var i in test) {
    if(test.hasOwnProperty(i)) {
        console.log(i);
    }
}