DEV Community

Discussion on: Javascript in a Ninja Way

Collapse
 
ryanpwalker profile image
Ryan Walker

const num1 = +"100" Does this shorthand work in all browsers?

Collapse
 
deepanmania profile image
Deepan

It's just usage of a unary operator '+'. So, I believe it will work the same on all browsers. But you cannot use const, instead of const use var since const is introduced in ES6.