category | created | tags | title |
---|---|---|---|
Tip |
2021-02-27 |
JavaScript |
Log a value to the Console |
There are a few ways to log a value to the Console, but using object destructuring is the convenient and short one.
const fullName = 'John Doe';
console.log('full name' + fullName);
console.log('full name', fullName);
// Better: use template string
console.log(`full name: ${fullName}`);
// Best: use object destructuring
console.log({ fullName }); // { fullName: 'John Doe' }