javascript split 分割問題

1 <mce:script type="text/javascript"><!--
2     $(document).ready(function () {
3         $('a').click(function () {
4             var array = ("").split(",");
5             document.writeln("數組長度:" + array.length);
6             document.writeln("數組值:"+array[0]);
7         });
8     });
9 // --></mce:script>

當字符串爲空的狀況下,使用逗號',',來分割,結果返回數組的長度爲1,數組值是空;javascript

相關文章
相關標籤/搜索