[英]Adding methods to a JavaScript object
I have an object that's the argument of a function. 我有一个对象,它是函数的参数。
I want to add methods to those objects, so I can easily perform operations on them. 我想向这些对象添加方法,以便可以轻松地对它们执行操作。
How do I add those methods to the object? 如何将这些方法添加到对象?
stuff.on('move', function (element) {
element.remove()
element.add()
element.change()
})
element.remove = function(){
...
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.