字符串对象的 split() 方法

<script type="text/javascript">
    var sentence = "the quick brown fox jumped over the lazy dog";
    var words = sentence.split(" ");
    for ( var i = 0; i < words.length; ++i) {
        document.write("word " + i + ": " + words[i]+"<br />");
    }
</script>

 

posted @ 2016-04-08 18:57  绯乐  阅读(255)  评论(0编辑  收藏  举报