摘要: 1. 把var声明的变量提升到当前作用域最前面,不会提升赋值 console.log(num); var num=10; //相当于 var num; console.log(num); num=10; //得不到10的结果; 2. 把函数声明 提升到当前作用域的最前面 test(); functi 阅读全文
posted @ 2019-10-11 17:31 handsomehe 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 1,函数作为参数 通常把函数作为参数叫做回调函数 function fn1(fn) { fn(); } fn1(function(){ console.log("哈哈"); }); 2,函数作为返回值 function fn1() { return function(){ console.log(" 阅读全文
posted @ 2019-10-11 16:33 handsomehe 阅读(2011) 评论(0) 推荐(0) 编辑