课程
/前端开发
/JavaScript
/JavaScript进阶篇
分割只能用,号(逗号)吗?
2015-07-13
源自:JavaScript进阶篇 7-9
正在回答
这样理解就很容易了: 字符串用split进行分割以后所以就成为了一个数组,例如:
var mychar="hello,javascript";
进行分割以后就变成了这样一个样子:["h","e","l","l","0",",","j","a","v","a","s","c","r","i","p","t"]
定义数组的时候: var myarry=["h","e","l","l","0",",","j","a","v","a","s","c","r","i","p","t"]
所以在用document.write()进行输出的时候中间是用“,”作为分割的。
是这样的,对于字符"-"用来代码制定划分数字,对于字符"."是用来划分字母的,最后显示出来是逗号。其实就是相应字符串分割成相应的字符。
分割是将string转化成数组,所以打印出来时是逗号分割
不能。
举报
本课程从如何插入JS代码开始,带您进入网页动态交互世界
4 回答关于split("")分割符号
2 回答为什么分割的符号是,
1 回答字符串分割
5 回答分隔符是其他的问题