现在位置: 首页 > var
2020年02月18日 web前端 ⁄ 共 869字 评论关闭

es6 for循环中let和var区别详解 let和var区别: for(var i=0;i<5;i++){ setTimeout(()=>{ console.log(i);//5个5 },100) } console.log(i);//5 console.log(‘=============’) for(let j=0;j<5;j++){ setTimeout(()=>{ console.log(j);//0,1,2,3,4 },100) } console.log(j);//报错 j is not define

阅读全文
2020年02月18日 web前端 ⁄ 共 1088字 评论关闭

微信小程序开发中var that =this的用法详解 在微信小程序开发中,var that =this的声明很常见.举个例子,代码如下! 示例代码1 //index.js Page({ data: { toastHidden: true, }, loadData: function () { var that = this//这里声明了that:将this存在that里面 wx.request({ url: ‘test.php’, data: {a: ‘a’, b: ‘b’}, header: { ‘content-type’: ‘applicat

阅读全文