Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

remove 0 from 01

const numString = "065";

//parseInt with radix=10
let number = parseInt(numString, 10);
console.log(number);

// Number constructor
number = Number(numString);
console.log(number);

// unary plus operator
number = +numString;
console.log(number);

// conversion using mathematical function (subtraction)
number = numString - 0;
console.log(number);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove
ADD COMMENT
Topic
Name
9+2 =