數(shù)組去重
var aRr=[1,3,4,1,6,9,1,2,5,3,1,6,5,4,4];
var aRr2=[];
for(var i=0;i<aRr.length;i++){
if (aRr.indexof(aRr[1])==1{
aRr2.push(aRr[i]);
}
}
alert(aRr2);
字符串處理
var str="2018-12-03";
var arr=str.split('-');//2018,12,03
alert(arr);
var arr = str.split('')//"2","0","1","8","-","1","2","-","0","3"
console.log(arr);
touppercase()轉(zhuǎn)大寫
tolowercase()轉(zhuǎn)小寫
字符串反轉(zhuǎn)
var str = "12sdadsad5646sadsadas";
//spilt()字符串轉(zhuǎn)為數(shù)組
//reverse()數(shù)組反轉(zhuǎn)
//join()數(shù)組轉(zhuǎn)成字符串
var str1 = str.split('').reverse().join('')
alert(str1)
先用spilt方法將字符串轉(zhuǎn)成數(shù)組,然后在用數(shù)組反轉(zhuǎn),最后用join將數(shù)組轉(zhuǎn)成字符串场仲。