例1——for循环
let A = [1, 2, 3, 4, 5]
for(let i=0; i<A.length; i++){
console.log(A[1])
}
let A = [1, 2, 3, 4, 5]
for(let i of A){
console.log(A[i])
}
例2——ajax的两种写法
ajax写法1
$.ajax({
url: url,
type: "post",
dataType: "json",
async: false,
success: function (data) {
console.log(data);
},
error: function (error) {
console.log(error)
}
});
ajax写法2
$.ajax({
url: url,
type: "post",
dataType: "json",
async: false,
});
.done(function(data){
console.log(data);
}
.fail(function(error){
console.log(error)
})
例3——获取对象中的值
let A = {"hello": "world"}
console.log(A.hello)
let A = {"hello": "world"}
console.log(A['hello'])