How in the world the output is not number?
How?
<script>
x = (function(foo){
return typeof(foo.bar);
})({ foo: { bar: 1 } });
console.log(x);
</script>
If should be foo.foo.bar
foo
parameter is an object with a property called foo
in it
x = (function(foo) {
return typeof(foo.foo.bar);
})({ foo: { bar: 1 } });
console.log(x);
You probably meant to destructure the argument like this:
x = (function({ foo }) {
return typeof(foo.bar);
})({ foo: { bar: 1 } });
console.log(x);