📜  检查数字的长度 javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:15.686000             🧑  作者: Mango

代码示例4
export function numberLength(number) {
    let length = 0;
    let n = Math.abs(number);
    do {
        n /= 10;
        length++;
    } while (n >= 1);
    return length;
}

export default numberLength;