Prototype-Base Programming(JS)
Everything in JavaScript is an Object Except of Primitive values such as numbers, Strings and etc. But as I mentioned Arrays are Object.
Now have you ever wondered why can we create an array and then use the push method on it?
const array=[1,2];
array.push(3);It is because of Prototypeal inheritance. Basically we create arrays from an array blueprint which is like a template and this is called the prototype.
Get Peyman’s stories in your inbox
Join Medium for free to get updates from this writer.
This prototype contains all the array methods and the arrays that we create in our code then inherit the methods from the blueprint so that we can use them on the arrays
This what I just explained to you is actually oversimplification which might still sound confusing so because of that you should be accustomed with Object Oriented Programming that is one of the most well-known Paradigms in programming







