Override x value with in the function and return it like this codeCode below
function test(x){
let obj={x:1,y:2}
if(!x)x=obj;
if(x.hasOwnProperty('x')){
return x.x;
}
else{
return "object does not have property x";
}
}
console.log(test(undefined)); // {x:1,y:2}
console.log(test(false)); // {x:1,y:2}
console.log(test(true)); // true