随笔分类 - es6
摘要:{ //原始对象 let obj={ time:'2017-03-11', name:'net', _r:123 }; //(代理商)第一个参数代理对象,第二个参数真正代理的东西 let monitor=new Proxy(obj,{ // 拦截对象属性的读取 get(target,key){ return target...
阅读全文
摘要://数据结构对比 增查改删 { //map、set和Object let item = {t:1}; let map = new Map(); let set = new Set(); let obj = {}; //增 map.set('t',1); set.add(item); obj['t'] = 1; co...
阅读全文
摘要://数据结构对比 增查改删 { //map和array对比 let map = new Map(); let array = []; //增 map.set('t',1); array.push({t:1}); console.info('map-array',map,array) //{"t"=>1};-[0:{t:1}] ...
阅读全文
摘要:{ let list = new Set(); list.add(5); list.add(7); console.log('size', list, list.size); //{5, 7} 2 } { let arr = [1, 2, 3, 4, 5]; let list = new Set(arr); console.log('...
阅读全文
摘要:{ // 声明 let a1 = Symbol(); let a2 = Symbol(); console.log(a1 === a2); //false let a3 = Symbol.for('a3'); let a4 = Symbol.for('a3'); console.log(a3 === a4); //true } { ...
阅读全文
摘要:{ //简洁表示法 let o = 1; let k = 2; let es5 = { o:o, k:k }; let es6 = { o,k }; console.log(es5,es6); //1,2;1,2 let es5_method = { hell...
阅读全文
摘要://函数参数默认值(more值后不能有参数) { function test(x,y = 'world'){ console.log('默认值',x,y); } test('hello');// hello world test('hello','kill'); //hello kill } //作用域概念 { let x = 'te...
阅读全文
摘要:{ let arr = Array.of(3, 4, 7, 9, 11); console.log('arr', arr); //[3,4,7,9,11] let empty = Array.of(); console.log(empty); //[] } //ES6为Array增加了from函数用来将其他对象转换成数组。 //当然,其他对象也是有要求,也不是所...
阅读全文
摘要:{ //二进制数值都是0b开头,八进制0o console.log(0b111110111) //503 console.log(0o767); //503 } { console.log('15',Number.isFinite(15)); //true console.log('NaN',Number.isFinite(NaN)); //false N...
阅读全文
摘要:{ console.log('a',`\u0061`); //a,a console.log('s',`\u20BB7`); //s ₻7 console.log('s',`\u{20BB7}`) //s 𠮷 }//charCodeAt 和 codePointAt{ let s = 'a'; le
阅读全文
摘要:{ //es5中 let regex = new RegExp('xyz', 'i'); let regex2 = new RegExp(/xyz/i); console.log(regex.test('xyz123'), regex2.test('xyz123')); // true,true /
阅读全文
摘要:1.结构赋值 { let a,b,c; [a,b] = [1,2]; console.log(a,b); //1,2} { let a,b,rest; [a,b,...rest] = [1,2,3,4,5,6]; console.log(a,b,rest); //3,[4,5,6]} 2.对象结构赋
阅读全文
摘要:一、let 和const 1.let 只在自己声明的块作用域中有效; function test(){ let a = 'a'; var b = 'b'; for(let i =1;i<3;i++){ console.log(i); //正常 1.2 } console.log(a,b); //正常
阅读全文
摘要:转自 http://blog.csdn.net/qq_29676303/article/details/76098196注意 事项 1.es6下创建三个目录 app server tasks 2.在 app下 创建 css js views 3.进入app/js目录 创建index.js(js入口文
阅读全文

浙公网安备 33010602011771号