JavaScript in Plain English

New JavaScript and Web Development content every day. Follow to join our 3.5M+ monthly readers.

Follow publication

Simple Ways to Convert a String into a Number

Dhairya Shah
JavaScript in Plain English
2 min readFeb 3, 2022

Hello Folks 👋

parseInt()

const x = "5"parseInt(x) // 5

Number()

const x = "5"Number(x)

Plus (+) unary operator

const x = "5"const num = +x

Published in JavaScript in Plain English

New JavaScript and Web Development content every day. Follow to join our 3.5M+ monthly readers.

Written by Dhairya Shah

I am 16 years old and have an intention to become a successful developer- I usually write about JavaScript and share some tips about it. Happy Coding!

No responses yet

Write a response