I am running the following code in a browser console and also with node.js v9.11.1
in the terminal:
let name = {};
Object.defineProperty(name, 'last', {value: 'Doe'});
console.log(name);
The browser console works properly and outputs { last: 'Doe' }
. But in the terminal with node.js
, it fails and outputs a blank object, {}
.
What could be the issue here?