var map = {
‘flammable’: ‘inflammable’,
‘duh’: ‘no duh’
}
$.each(map, function(key, value) {
alert(key + ‘: ‘ + value)
})
2. js里是很灵活的
var A = {a:1,b:2,c:3,d:"hello world"}
for(let k in A) {
console.log(k,A[k])
}
获取查询字符串的上的指定值:function getParam(key, strURL) {strURL = strURL || window.location.search return new RegExp("(^|\\?|&)" + key + "=([^&]*)(\\s|&|$)", "i").test(strURL) ?decodeURIComponent(RegExp.$2.replace(/\+/g, " ")) : ""} // 调用getParam('key', '链接')