数组
2018-05-14 本文已影响0人
Abby_qi
检测是否是数组:
ES3检测是否是数组:
Object.prototype.toString.call(要判断的变量)
ES5检测是否是数组:
Array.isArray()
数组转字符串:join("分隔符")
字符串转换数组:split("分隔符")
js对象转换成js字符串:stringify()
js字符串转换成js对象:parse()
函数表达式与函数声明
if (window.location.toString().indexOf('pref=padindex') != -1) {
} else {
if (/AppleWebKit.*Mobile/i.test(navigator.userAgent) || /\(Android.*Mobile.+\).+Gecko.+Firefox/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))) {
if (window.location.href.indexOf("?mobile")<0){
try {
if (/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
window.location.href="https://xw.qq.com?f=qqcom";
} else if (/iPad/i.test(navigator.userAgent)) {
//window.location.href="http://www.qq.com/pad/"
} else {
window.location.href="http://xw.qq.com/simple/s/index/"
}
} catch (e) {}
}
}
}