var isNumber = function isNumber(value){ return typeof value === 'number' && isFinite(value); } ------------------------------------------------------------------ var i; var word; var text = "This oracle of comfort has so pleased me, "+ "That when I am in heaven I shall desire "+ "To see whtat this child does, "+ "and praise my Constructor."; words = text.toLowerCase().split(/[s,.]+/); var count = {}; for(i=0;i<words.length;i++){ word = words[i]; if(count[word]) count[word]+=1; else count[word]=1; } ----------------------------------------------------------------------- if(typeof Object.beget !== "function"){ Object.beget = function(o){ var F = function(){}; F.prototype = o; return new F(); } } ------------------------------------------------------------------------- var Foo = function(string){ this.status = string; }; Foo.prototype.get_status = function(){ return this.status; } var myFoo = new Foo("hello_world"); alert(myFoo.get_status()); ------------------------------------------------------------------------- var statusObject = { "status":"OK" } var status = Foo.prototype.get_status.applay(statusObject);