How to extract last(end) digit of the Number value using jquery. because i have to check the last digit of number is 0 or 5. so how to get last digit after decimal point
<toString()
converts number to string, and charAt()
gives you the character at a particular position.
var str = 3232.43;
lastnum = str.toString().charAt( str.length - 1 );
alert( lastnum );
Here is another one using .slice():
var test = 2354.55;
var lastDigit = test.toString().slice(-1);
//OR
//var lastDigit = (test + '').slice(-1);
alert(lastDigit);