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

in #javascript7 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.

Sort:  

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 !

Coin Marketplace

STEEM 0.20
TRX 0.12
JST 0.028
BTC 64182.15
ETH 3505.45
USDT 1.00
SBD 2.53