javascript anonymous autoexec with parameter -


i creating javascript object anonymous function this

(function(){   window['d'] = this;   this.sayhello = function(){     console.log("hello world");   }  })(); 

how pass parameter d object can call d(someparams).sayhello() can call d.sayhello(). need change , where?

(function(){   var pars = arguments[0] || {};   window['d'] = this;   this.sayhello = function(){     console.log("hello world");   }  })({a:'test'}) 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -