How to console.log the name of the variable as well as its value
This tweet from @wesbos is a great tip, anything that makes working with JavaScript in Developer Tools for your browser of choice has got to be a bonus, right?
Wrap your console.log arguments in an object literal to print the variable name along with its value.
— Daniel Stefanovic (@DaniStefanovic) June 27, 2018
console.log(isLoggedIn)
console.log({ isLoggedIn })
Still one of my favorite tips from @wesbos. So simple but effective 💪 pic.twitter.com/wMrDt4JDJ4
;Rather than going to the effort of writing:
console.log('isLoggedIn: ' + isLoggedIn);
You can short-hand it by writing:
console.log({isLoggedIn});
Simples!