当前位置: 首页 > 网络学院 > 客户端脚本教程 > JavaScript > JavaScript length 属性
The length property returns the number of characters in a string.
length属性返回一个字符串的字符数量
stringObject.length |
In this example we will show how to use the length property to return the number of characters in a string:
在下面的例子中,我们将岩石如何用length属性来返回一个字符串的字符数:
<script type="text/javascript"> var txt="Hello World!" </script> |
The output of the code above will be:
输出结果为:
12 |
length
In this example we will show how to use the length property.
在本例子中,我们将演示如何应用length属性