Javascript plugin creation

Posted by Aneesh on Stack Overflow See other posts from Stack Overflow or by Aneesh
Published on 2010-04-14T07:03:36Z Indexed on 2010/04/14 7:13 UTC
Read the original article Hit count: 137

Filed under:
|

I want to create a plugin called 'myPlugin'. Which method should I use and what is the difference between these two methods? Please tell me the advantages too. I am from designing background and not much programming knowledge.

 var myPlugin = {
     myId:"testId",        
     create:function(){},
     destroy:function(){}
}

OR

function myPlugin() {
this.myId = "testId";
this.create = function(){};
this.destroy = function(){};

}

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about oop