Skip to content

Instantly share code, notes, and snippets.

@md2perpe
Forked from fogus/gist:1002886
Created June 1, 2011 22:05
Show Gist options
  • Save md2perpe/1003456 to your computer and use it in GitHub Desktop.
Save md2perpe/1003456 to your computer and use it in GitHub Desktop.
Methods and fields in Javascript
var M = function() { };
M.prototype = {
m : function() { return 42 }
};
var inst = new M();
inst.f = function() { return 42 };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment