I have an object that has some default properties in it. I want to override those properties if options have been passed to my method.
myMethod: function(options){
var myObj = {
prop1: _this.get('data1'),
prop2: _this.get('data3'),
prop3: _this.get('data4'),
};
if(options){
$.extend( myObj, options );
}
}
When I do a log on myObj after the $extend is called its not showing the new data that was passed in via options
myMethod({prop1:"newData1", prop2:"newData2", prop3:"newData3"})
Andrew Whitaker answered this in his comment above, it seems, with this jsfiddle:
http://jsfiddle.net/EWeTt/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With