3 ms·
Pretty cool, but cant print basic objects const m = {year: 2019, month: 12}; console.log(m); // [object Object] Compare with Node: { year: 2019,
by svnpenn 6y ago
Pretty cool, but cant print basic objects
const m = {year: 2019, month: 12};
console.log(m); // [object Object]
Compare with Node:
{ year: 2019, month: 12 }
- jhardy54 6y agoThe spec leaves that up to the implementation: https://console.spec.whatwg.org/#log https://console.spec.whatwg.org/#log Node does some custom fanciness, but Object.prototype.toString() is equally correct.
- svnpenn 6y agoWorkaround: let m = {year: 2019}; let s = JSON.stringify(m); console.log(s); // {"year":2019}