Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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); 
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #number #integer #js
ADD COMMENT
Topic
Name
7+2 =