摘要: 1、利用.length增加或减少数组长度var colors=["red","blue","green"];colors.length=2; //数组长度强制变为2alert("colors[2]"); //undefined colors[colors.lengt... 阅读全文
posted @ 2014-09-20 13:52 Shimily 阅读(174) 评论(0) 推荐(0)
摘要: JS自带函数concat将两个或多个字符的文本组合起来,返回一个新的字符串。var a = "hello";var b = ",world";var c = a.concat(b);alert(c);//c = "hello,world"indexOf返回字符串中一个子串第一处出现的索引(从左到右搜... 阅读全文
posted @ 2014-09-20 13:13 Shimily 阅读(106) 评论(0) 推荐(0)