How to delete the first digit from a number in JavaScript

1 Answer

0 votes
let n = 853271;

console.log(parseInt(Math.log10(n)));
console.log(parseInt(Math.pow(10, parseInt(Math.log10(n)))));

n = n % parseInt(Math.pow(10, parseInt(Math.log10(n))));
 
console.log(n);



/*
run:

5
100000
53271

*/

 



answered Jun 6, 2020 by avibootz

Related questions

1 answer 156 views
1 answer 204 views
1 answer 179 views
1 answer 158 views
2 answers 206 views
1 answer 173 views
4 answers 305 views
...