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 247 views
1 answer 308 views
1 answer 263 views
1 answer 246 views
2 answers 310 views
1 answer 256 views
4 answers 478 views
...