title | category | date | topics |
---|---|---|---|
Log a value to the Console |
Tip |
2021-02-27 09:50:00 +7 |
JavaScript |
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' }