Could any one tell me the right way to create libraries from below options.
//option 1
function Fruit(){
var color,shape;
this.start = function(l,callback){
color = "Red"; shape = "Circle";
return callback();
}
}
//option2
function Fruit(){
this.start = function(l,callback){
this.color = "Red"; this.shape = "Circle";
return callback();
}
}
//option3
var Fruit = {
var color,shape;
start : function (l,callback) {
color = "Red"; shape = "Circle";
return callback();
}
}
I want to know which is the right way to create Objects and Functions inside of it. If all three options are wrong, could any one tell me the right way.