function test(value)
{
var defaults = {
check: 0,
point: true
}
}
function extend() {
for (var i = 1; i < arguments.length; i++)
for (var key in arguments[i])
if (arguments[i].hasOwnProperty(key))
arguments[0][key] = arguments[i][key];
return arguments[0];
}
function test(value) {
var defaults = {
check: 0,
point: true
};
return extend(defaults, value);
}
console.log( test() ); // Object { check=0, point=true}
console.log( test({check: 555}) ); // Object { check=555, point=true}
console.log( test({check: 10, point: false}) ); // Object { check=10, point=false}
return
function test(value)
{
var defaults = {
check: 0,
point: true
}
return defaults;
}
function test(value)
{
var defaults = {
check: 0,
point: true
}
if (value.check !== undefined)
defaults.check = value.check;
if (value.point!== undefined)
defaults.point = value.point;
return defaults;
}