Jul 12, 2022
Problem statement :
Prototype for printing all the elememnts of the array.
Array.prototype.printElements = function(){
const arrayLength = this.length;
if(arrayLength){
for(let i=0;i<arrayLength;i++){
console.log(this[i])
}
}
}
const a = [1,2,3,4,5];
a.printElements();