Home > shorts > See variable name in console
See variable name in console
Wrap the arguments in curly brackets in console.log to see the variable name when logged.
const twitter = "andrew_losseff"
const instagram = "short_dev_tips"
const languages = ["JavaScript", "TypeScript", "Ruby", "Python"]
console.log({twitter, instagram, languages})
// Output
{
twitter: "andrew_losseff"
instagram: "short_dev_tips"
languages: ["JavaScript", "TypeScript", "Ruby", "Python"]
}
Check the demo here => CodePen