Q: Assigning false returns undefined the following code is outputting "undefined" but when x is true, it works.
If I assign string 'false' it is correct.
Does anyone have an idea?
var _obj= {"istrue":false};
var y = (x)=>({z:x.istrue})
const uCall = y(_obj);
console.log(uCall.z);

Update
I updated the code to reflect my actual code.
When I run the code in browser it works but when I run it in a service, it returns undefined.

A: You are reading the z property of the function instance. You need to call your y function, with a parameter.


var x= false;
var y = (x)=>({z:x})
console.log(y('testing123').z);



A: Not quite sure what you aim to achieve. You are setting the variable y as a function which takes x as an argument (not the global variable x but an argument x). If you run y(x) then you'll receive an object {z: false}
