When im working with javaScript plugins I often come across this approach for adjusting a plugins behaviour.
$('.mySlider').slider({status: "burnt"});
If I try and replicate this kind of approach with an object like so
var Egg = function(){
this.details = {
status: "cooked",
make: "Happy Egg"
}
};
var egg = new Egg({status: "burnt"});
console.log(egg.details.status);
I just get a bunch of undefined messages from the console. can anyone show me how to create an object and then change its properties like the above example?
Thanks
Your constructor is not taking any arguments, yet you are passing them in when you create a new instance.
you would want
or perhaps
and then you would do just
egg.statusto get the property.