1:var ,let ,const
const与let是局部作用域,不能重复声明,不能变量提升,const用于声明常量,且声明后不能重复赋值
2:ES6 中有 class 语法。值得注意是,这里的 class 不是新的对象继承模型,它只是原型链的语法糖表现形式。 函数中使用 static 关键词定义构造函数的的方法和属性:
class Animal { c
onstructor(color,age){ t
his.color = color; t
his.age = age;
}
yeil(){
alert("我大声咆哮");
}
}
3:模块化,需要注意的是在html中模块化引入js
1. 有http服务器 2. <script type="module">
示例:
export 导出
var name = "mumu";
export{name};
function say(){
alert('我喜欢'+name)
}
export {say};
import 导入
<script type="module">
import {name,say} from './js/utils.js';
say();
</script>
导出默认
class Now{
constructor(arg) { t
his.date = new Date().
toLocaleString()
}
}
export default Now 导入默认
import Now from './js/utils.js';
alert(new Now().date)
4:可迭代对象
set去重
Map图