M.O.S. Studios Posted June 16, 2011 Share Posted June 16, 2011 I made this function, now it appears when ever i do a "for ... in". How do I attach it to the array object with out attaching it to all the instances Array.prototype.leap = function(){ var y = this; y.shift(); return y; } Link to comment https://forums.phpfreaks.com/topic/239569-prototypes/ Share on other sites More sharing options...
gizmola Posted June 16, 2011 Share Posted June 16, 2011 When you make something part of the prototype, you are making it part of all instances. The Prototype is roughly equivalent to a class definition in javascript. Link to comment https://forums.phpfreaks.com/topic/239569-prototypes/#findComment-1230695 Share on other sites More sharing options...
M.O.S. Studios Posted June 16, 2011 Author Share Posted June 16, 2011 thanks Link to comment https://forums.phpfreaks.com/topic/239569-prototypes/#findComment-1230701 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.