Contact: aviboots(AT)netvision.net.il
43,874 questions
57,260 answers
573 users
function firstDecimalDigit(f : number): string { return f.toString().split('.')[1][0]; } const f = 895.98731; console.log(firstDecimalDigit(f)); // "9" /* run: 9 */
function firstDecimalDigit(f : number): number { return (Math.floor(Math.abs(f) * 10)) % 10 } const f = 895.98731; console.log(firstDecimalDigit(f)); /* run: 9 */