如何找到数字的长度? [英] How can I find the length of a number?
本文介绍了如何找到数字的长度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要获取JavaScript或jQuery中数字的长度吗?
I'm looking to get the length of a number in JavaScript or jQuery?
我尝试过 value.length
没有成功,是否需要先将其转换为字符串?
I've tried value.length
without any success, do I need to convert this to a string first?
推荐答案
var x = 1234567;
x.toString().length;
此过程也适用于浮点数
以及指数数字
。
这篇关于如何找到数字的长度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文