TIL in JavaScript console.log you can do variable,variable

in javascript •  7 years ago 

consolelogwtf.png

Ha, after programming in JavaScript for many many years, I just realized that you can type

console.log(variable1, variable2, variable3)

for all that time I had done something like console.log(variable1 + " " + variable2)

oops !

Guess it is never to late to learn new tricks.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

yep! you should look into ES6 features as well! you can actually use variables via ${variableName}

Yes! I really like this:

var name = 'matthewdavid'
console.log('My name is ${name}.')

nice, will check it out thanks for the tip !