1. 程式人生 > >DevTools: Improved Logging of Multiple Values

DevTools: Improved Logging of Multiple Values

DevTools: Improved Logging of Multiple Values

Writing multiple values to the console usually looks like this — using ordinary console.log:

console.log(age, name, home, company, website)

This is not very readable, but one small change can already improve that. Just wrap all the variables you want to log inside a pair of curly braces:

console.log({ age, name, home, company, website })

But you can go one step further and swap log with table and enjoy a whole new experience when logging multiple variables:

console.table({ age, name, home, company, website })

If you have an even clearer approach on logging multiple values, please let me know in the comments or via one of the usual channels.