showing results for - "get the first number of the integer in js"
Orson
18 Nov 2017
1var number = 132943154134;
2
3// convert number to a string, then extract the first digit
4var one = String(number).charAt(0);
5
6// convert the first digit back to an integer
7var one_as_number = Number(one); 
8