js 处理金额各个位数上的值

    //金额处理
    var number = 1234567.35;
    if (parseInt(number) == number) {
        var money = number.toString().split('');
        var unit = money[money.length - 1];
        var decade = money[money.length - 2];
        var hunders = money[money.length - 3];
        var kilbit = money[money.length - 4];
        var myriabit = money[money.length - 5];
        var debit = money[money.length - 6];
        var hunbit = money[money.length - 7];
        console.log(hunbit)
    }else{
        var money = number.toString().split('.')[1];
        var unitone = money.split('')[0];
        var unittwo = money.split('')[1]
    }

  

posted @ 2018-01-11 14:44  abcByme  阅读(724)  评论(0编辑  收藏  举报