You can use prototype
property to add method to built-in Javascript objects
I am going to add inArray() to Array object in Javascript
Array.prototype.inArray=function(value){ for(var i=0;i<this.length;i++){ if(this[i]===value){ return true } } return false } var numbers =[1,2,3,4,5,6,7,8] console.log(numbers.inArray(9))
So number 9 is not array and you will get the output false