Answers for "how to parse number from string js"

5

js get number from string

thenum = "foo3bar5".match(/\d+/)[0] // "3"
Posted by: Guest on January-08-2021
1

JS cast a string into a Number

const input = "42";
const number = Number.parseInt(input, 10);
Posted by: Guest on September-15-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language