prototype-programming
Possible to access private constructor-scoped variables from a functions prototype?
Based on my understanding of javascript, prototype methods cannot access variables that are private to the scope of the constructor,[详细]
2023-04-13 04:58 分类:问答When I add and array to an object using prototype in Javascript, all instances of the object act like they're sharing one array [duplicate]
This question already has answers here: Javascript object members that are prototyped as arrays become shared by all class instances[详细]
2023-04-12 17:07 分类:问答JavaScript OO issue when accessing instance methods
I\'ve used a few tutorials on OOP in JavaScript. It seemed to go well, until I met the following... Result of expression \'this.prepareFrame\' [undefined] is not a function.[详细]
2023-04-11 19:18 分类:问答Extending the Boolean Object in Javascript with an 'invert' function
I would like to extend the Boolean object with a prototype function that inverts it\'s current value. Until now, I\'ve been doing something like this:[详细]
2023-04-10 20:51 分类:问答Prototype object can be changed from instance
Could someone explain this to me in a sensible way: function One() {} One.prototype.obj = { key: \'value\' };[详细]
2023-04-10 04:16 分类:问答What is the difference between an object and a prototype in prototypal programming?
I\'m trying to understand the \"JavaScript way\" of creating and using objects and I think I\'m running into a misunderstanding of an object and a prototype.[详细]
2023-04-07 11:43 分类:问答JavaScript inheritance: when constructor has arguments
Using pure JavaScript to do inheritance, this is what I usually do: function A() {} A.prototype.run = function () {};[详细]
2023-04-06 20:50 分类:问答Node.js prototypal inheritance with require
I have a problem with inheritance of two functions in node.js when i use require functions. Here is my case:[详细]
2023-04-05 08:34 分类:问答JavaScript: modify prototype of an object's variable?
Here is an object: var obj = new function(){ this.prop = {}; } and I try to do something like: obj.prop.prototype[\"new_attr\"] = \"some_value\";[详细]
2023-04-04 05:14 分类:问答Old object as a prototype
I\'m reading this book and there is a chapter about prototypes with this hard to understand paragraph and code snippet.[详细]
2023-04-03 22:52 分类:问答