摘要: ES5创建对象的方式 每个对象都能使用原型对象prototype的方法 继承 原型继承 Dog.prototype = new Animal(); ES6创建对象的方式 constructor构造函数 继承 阅读全文
posted @ 2022-10-26 19:03 ben10044 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 设置函数默认值 /* function fun(n,m){ return n+m; } let result=fun();//没有参数时n和m的值都是defined console.log(result);//NaN Not a Number */ function fun(n=10,m=20){/ 阅读全文
posted @ 2022-10-26 11:49 ben10044 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 概述 变量 块级作用域 var str = "hello"; console.log(str);//hello { var str1 = "world"; } console.log(str1);//world { let str2 = "helloworld"; } console.log(str 阅读全文
posted @ 2022-10-26 10:37 ben10044 阅读(80) 评论(0) 推荐(0) 编辑