JavaScript: What are .extend and .prototype used for?
Javascript’s inheritance is prototype based, so you extend the prototypes of objects such as Date, Math, and even your own custom ones. Date.prototype.lol = function() { alert(‘hi’); }; ( new Date ).lol() // alert message In the snippet above, I define a method for all Date objects ( already existing ones and all new ones … Read more