摘要: 1 //Symbol生成一个独一无二的值,生成的值不会相等 2 { 3 //声明1 4 let a1=Symbol(); 5 let a2=Symbol(); 6 console.log(a1===a2);//false 7 //声明2 8 let a3=Symbol.for('a3'); 9 let a4=Symbol.... 阅读全文
posted @ 2018-06-26 10:26 chenlw101 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 1 //对象 2 { 3 //简洁表示法 4 let o = 1; 5 let k = 2; 6 let es5 = { 7 o:o, 8 k:k 9 }; 10 let es6 = { 11 o, 12 k 13 }; 14 console.log(... 阅读全文
posted @ 2018-06-26 10:25 chenlw101 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 1 { 2 //有默认值的后面如果有参数必须要有默认值 3 function test(x,y="world"){ 4 console.log(x,y) 5 } 6 test('hello');//hello world 7 test('hello',"kill");//hello kill 8 9 } 10 { 11 ... 阅读全文
posted @ 2018-06-21 17:22 chenlw101 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 1 //数组扩展 2 { 3 let arr=Array.of(3,4,6,7,9,11);//可以是空 4 console.log('arr=',arr);//[3,4,6,7,9,11] 5 } 6 { 7 //Array.from把伪数组或者集合变为数组 8 let p=document.querySelectorAll('p'); 9 ... 阅读全文
posted @ 2018-06-21 16:10 chenlw101 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 1 { 2 //Number.isFinite数字是有尽的 3 console.log(Number.isFinite(15));//true 4 console.log(Number.isFinite(NaN));//false 5 console.log(Number.isFinite('true'/0));//false 6 co... 阅读全文
posted @ 2018-06-21 15:39 chenlw101 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 1 //字符串扩展 2 { 3 console.log('a','\u0061'); 4 console.log('s','\u20BB7');//超过了0xffff 5 6 console.log('s','\u{20BB7}');//如果超过就用{}包裹 7 8 } 9 { 10 //es5中 11 let s='𠮷'; 12 ... 阅读全文
posted @ 2018-06-21 15:08 chenlw101 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 1 //正则扩展 2 { 3 let regex=new RegExp('xyz','i'); 4 let regex2=new RegExp(/xyz/i); 5 6 console.log(regex.test('xyz123'),regex2.test('xy')); 7 //后面的修饰符i覆盖原来的ig修饰符 8 let rege... 阅读全文
posted @ 2018-06-21 14:09 chenlw101 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 1 //解构赋值 2 3 { 4 let a,b,rest; 5 [a,b]=[1,2]; 6 console.log(a,b); 7 } 8 //数组解构赋值 9 { 10 let a,b,rest; 11 [a,b,...rest]=[1,2,3,4,5,6]; 12 console.log(a,b,rest); 13 } ... 阅读全文
posted @ 2018-06-21 13:33 chenlw101 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 1 function test(){ 2 //let只在块作用域有效 3 for(let i=1;i<3;i++){ 4 console.log(i); 5 } 6 //es6严格模式,变量未声明,不可以用 7 //console.log(i); 8 //let 里面不可以声明两个相同的变量 9 let a... 阅读全文
posted @ 2018-06-21 11:35 chenlw101 阅读(74) 评论(0) 推荐(0) 编辑
摘要: 命令:express -e ./ express表示安装express -e表示使用ejs作为模板 ./表示当前目录中 (使用上面的命令之前我们应该使用npm安装express框架 sudo npm install -g express sudo npm install -g express-gen 阅读全文
posted @ 2018-06-20 16:43 chenlw101 阅读(132) 评论(0) 推荐(0) 编辑