I saw this in a plugin:
var options = $.extend(defaults, options);
How does it work?
What does extend() do?
It merges the content of one object to another. If we pass two objects, second object properties are added to the first object / first parameter
Ex: $.extend(object1, object2);
Now object1 contains properties of object2
If we want to merge two objects, then we need to pass empty object in the first parameter
Ex: var newObject = $.extend({}, object1, object2);
Now newObject contains both properties of object1 and object2.