Answers for "get the first number of the integer in js"

0

get the first number of the integer in js

var number = 132943154134;

// convert number to a string, then extract the first digit
var one = String(number).charAt(0);

// convert the first digit back to an integer
var one_as_number = Number(one);
Posted by: Guest on August-24-2021

Code answers related to "get the first number of the integer in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language