Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

edited tags
Link
Jack Bashford
  • 44.3k
  • 11
  • 56
  • 84
Source Link
cattt
  • 39
  • 8

Creating a "method" method on an object

Can someone explain me how they are creating a "method" method on an object.

var foo = {};
foo.method = function(name, cb){
 this[name] = cb;
};
lang-js

AltStyle によって変換されたページ (->オリジナル) /