2017年4月19日
摘要: function p(flag){ return new Promise((resolve , reject)=>{ if(flag){ resolve('ok'); }else{ reject('no'); } }); } function a(){ alert('a'); } function b(){ alert('b')... 阅读全文
posted @ 2017-04-19 11:16 宝清老窖 阅读(150) 评论(0) 推荐(0) 编辑
  2017年4月18日
摘要: 新建一个webpack-demo工程,然后在根目录下建一个webpack.config.js文件,格式如图 1、单个文件打包模式,webpack.config.js 2、如果有另一个文件webpack.dev.config.js 运行命令为 webpack --config webpack.dev. 阅读全文
posted @ 2017-04-18 22:14 宝清老窖 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 1、最简单的命令 hello.js webpack hello.js hello.bundl.js //即把hello.js 压缩成 hello.bundle.js 2、requrie hello.js world.js webpack hello.js hello.bundle.js 3、requ 阅读全文
posted @ 2017-04-18 21:12 宝清老窖 阅读(117) 评论(0) 推荐(0) 编辑
  2017年4月17日
摘要: rest 参数 排序 扩展运算符 function push(array, ...items){ array.push(...items)}var arr = [1,2,3]push(arr, 4,5,6);console.log(arr); //[1,2,3,4,5,6] const [first 阅读全文
posted @ 2017-04-17 23:56 宝清老窖 阅读(150) 评论(0) 推荐(0) 编辑
摘要: var arrayLike = { '0': 'a', '1': 'b', '2': 'c', 'length': 3 } var arr1 = [].slice.call(arrayLike); console.log(arr1); //['a','b','c'] var arr2 = Array.from(arrayLike); console.log(arr2); ... 阅读全文
posted @ 2017-04-17 22:25 宝清老窖 阅读(141) 评论(0) 推荐(0) 编辑
  2017年4月16日
摘要: (function(){ /*for(var i = 0; i ') },1000) } console.log(i + ' ->');*/ //5->5=>5=>5=>5=>5=> })(); //输出5,0,1,2,3,4 (function(){ /*for(var i = 0; i { function resolve(){ ... 阅读全文
posted @ 2017-04-16 20:18 宝清老窖 阅读(182) 评论(0) 推荐(0) 编辑
  2017年4月15日
摘要: //基本技巧 //尽量少用全局变量 myglobal = 'hello'; //反模式 console.log(myglobal) console.log(window.myglobal) console.log(window['myglobal']) console.log(this.myglobal) function sum(x,y){ result = x + y; return... 阅读全文
posted @ 2017-04-15 00:42 宝清老窖 阅读(122) 评论(0) 推荐(0) 编辑
  2017年4月14日
摘要: 字符串模板 String.raw = `test Raw \ run '' "" //` 阅读全文
posted @ 2017-04-14 16:01 宝清老窖 阅读(121) 评论(0) 推荐(0) 编辑
  2017年4月12日
摘要: 默认值 对象解析 字符串 数值和布尔 函数参数的 结构解析 用途 阅读全文
posted @ 2017-04-12 10:49 宝清老窖 阅读(122) 评论(0) 推荐(0) 编辑
  2017年3月23日
摘要: 做个分享 阅读全文
posted @ 2017-03-23 15:06 宝清老窖 阅读(100) 评论(0) 推荐(0) 编辑