A JavaScript Puzzler

var M = function() { this.m = function() { return 42 } };

var inst = new M();

inst.f = function() { return 42 };

// How to tell that f is a function in a field and // m is a method in an arbitrary object? // // example:

is_method(inst.f); //=> false

is_method(inst.m); //=> [...]

 •  0 comments  •  flag
Share on Twitter
Published on June 01, 2011 15:33
No comments have been added yet.