new to javascript: not sure what function (o) means -


what o ?

if not mistaken, prototype means f going inherit o , can understand here.

can break down me:

if (!object.create) {   object.create = (function () {   var f = function(){};    return function (o) {     if (arguments.length !== 1) {         throw new error('object.create implementation accepts 1 parameter.');     }     f.prototype = o;     return new f();   }; }()); 

o parameter pass function.

for example:

var myobj = object.create({         myfn: function(){} }); 

then can do:

myobj.myfn(); 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -