DEV Community

Discussion on: Javascript Shorthand Coding Techniques

Collapse
 
miteshkamat27 profile image
Mitesh Kamat

// Longhand
const quantity = parseInt("250")
const price = parseFloat("432.50")

// Shorthand
const quantity = +"250" // converts to int
const price = +"432.50" // converts to float

I have a habbit of using parseInt parseFloat everytime.I would surely follow this shorthand.