DEV Community

Discussion on: Like `console.log` But Better

tylerlwsmith profile image
Tyler Smith

Great article, I had never heard on console.assert!

One of the things that I starting doing as a short hand for writing labels is wrapping the variables in an object literal. It saves on the repetitive typing!

const firstName = 'Leira';
const lastName = 'Sánchez';
console.log({firstName, lastName}); // {firstName: "Leira", lastName: "Sánchez"}
Enter fullscreen mode Exit fullscreen mode
leirasanchez profile image
Leira Sánchez Author

Wow! This great! I will definitely be using this from now on. Thank you 🙂

vbelolapotkov profile image
Vasily Belolapotkov

I like that trick too! And now with console.table you can make it look even better!