js计算数字长度

js调用toString方法转为字符串后取长度

var num = 123;
alert(num.toString().length);

 

posted @ 2018-06-19 15:16  万里冰封  阅读(2006)  评论(0编辑  收藏  举报