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 148 views
1 answer 192 views
1 answer 162 views
1 answer 139 views
2 answers 187 views
1 answer 160 views
4 answers 275 views
...