摘要:
<script> var person = { 'name': '张三', 'age': 20 } var pro = new Proxy(person, { get(target, property) { return '李四' } }) console.log(pro.name) console 阅读全文
摘要:
/* // 传统写法 var sum =function(a) { return a ; } // 箭头函数写法 var sum =a => a; */ // var sum = function(a,b) { // return a+b; // } // console.log(sum(1,2)) 阅读全文
摘要:
函数默认值 把默认值的设定放在了参数上,而不需要在函数体内进行检测,一般将带默认值的参数放在最后。只有当传入的参数为undefined,才会触发默认值赋值。否则,哪怕你传的参数值为0,false,null都不会触发默认值赋值 function person2(name = 'maqiao', age 阅读全文
摘要:
ES6对象方法 传统 // // 传统表示 // let person = { // 'name':'zs', // 'say': function(){ // console.log('123') // } // } // person.say() var name = 'zs'; var age 阅读全文
摘要:
1、Array.of() 将任意一组值转换为数组 //Array.of() // var arr = new Array(1, 2, 3, 5, 8) // var str = '12,3,5,6,ss' // console.log(Array.of(str)) 2、Array.from() 将类 阅读全文
摘要:
1、isNaN() 如果是一个数,则返回false, 否则返回true 注意:Number.isNaN返回结果为false时,不一定代表该值定是数字,字符串也可以返回false //isNaN console.log(isNaN(2.5))//false console.log(window.isN 阅读全文
摘要:
模板字符串</head> <body> <div id="div1"> <table> <tr> <td></td> <td></td> <td></td> <td></td> </tr> </table> </div> </body> <script> // var res = '<table>< 阅读全文
摘要:
定义:从数组和对象中提取值,对变量进行赋值 1、数组的解构赋值 (1).解构赋值可以嵌套 let [a,[b,c],[d,e]] = [11,[12,13],[14,15]]; console.log(a,b,c,d,e);//11,12,13,14,15 (2).不完全解构 当左边的模式(你可以理 阅读全文
摘要:
利用nodejs进行bable导入 启动命令提示符窗口并且输入:npm install babel-core@5,然后回车 使用,然后用ie9打开测试 引入 <script src="./node_modules/babel-core/browser.min.js"></script> <scrip 阅读全文
摘要:
const 声明常量 1、不能重复声明常量名 // var num = 10; // const num = 15; // console.log(num) //Identifier 'num' has already been declared 2、声明后必须赋值 字符串,数字 布尔值等基本数据类 阅读全文