欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  web前端

JavaScript实现把数字转换成中文_javascript技巧

程序员文章站 2022-04-27 17:36:00
...
var _change = {
           ary0:["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"],
           ary1:["", "十", "百", "千"],
           ary2:["", "万", "亿", "兆"],
           init:function (name) {
               this.name = name;
           },
           strrev:function () {
               var ary = []
               for (var i = this.name.length; i >= 0; i--) {
                   ary.push(this.name[i])
               }
               return ary.join("");
           }, //倒转字符串。
           pri_ary:function () {
               var $this = this
               var ary = this.strrev();
               var zero = ""
               var newary = ""
               var i4 = -1
               for (var i = 0; i