猜猜什么是回调地狱?
// typeof与instanceof区别
var arr=[1,2,3,4,5];
// console.log(typeof arr); 返回object类型
// console.log(typeof{}); 返回object
// console.log(arr instanceof Array);确定是什么类型的数据
// console.log({} instanceof Object);
// console.log(arr instanceof Object);
// call 与 apply 与 bind 的区别
// call调用object里面的东西
// console.log( Object.prototype.toLocaleString.call(arr))
// console.log( Object.prototype.toLocaleString.apply(arr))
// bind返回的是函数的拷贝 如果要调用需要在后面加 ();
// console.log( Object.prototype.toLocaleString.bind(arr)())
// 高阶函数(函数套函数)
// function f(){
// console.log("f()");
// }
// f()
// function f(){
// return function(){
// console.log("f()");
// }
// }
// f()()
// console.log(f())
// 回调函数
// function f(fun,fun2){
// // arguments
// btn.click = function (){
// fun()
// fun2()
// }
// }
// function sum(){
// console.log("sum");
// }
// sum();
// f(sum);
// // 回调地狱 这玩意务必避免掉
// function f(fun){
// fun();
// }
// f(f(f(f(f(f())))))
浙公网安备 33010602011771号