ES6 template literal with object
Solution 1:
JSON stringify it.
function func() {
const obj = {
a: 1,
b: 2
};
console.log(`obj = ${JSON.stringify(obj)}`);
}
func();
JSON stringify it.
function func() {
const obj = {
a: 1,
b: 2
};
console.log(`obj = ${JSON.stringify(obj)}`);
}
func();