摘要: 1.const常量的使用 const 不能重复声明 const 不属于顶层对象window const不存在变量提升 暂时性死区 块级作用域 2.正常来说const是不可改变的常量,但是const在有些地方是可以被改变的 const 声明基本数据类型的时候。number , 布尔,字符串,undef 阅读全文
posted @ 2021-12-10 16:28 小基狠努力啊 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 1.环境构建 安装Node.js环境:https://nodejs.org/zh-cn/ 进入到项目,初始化package.json : npm init -y 安装:npm instaall --save-dev babel-preset-env babel-cli 创建文件夹并配置:.babel 阅读全文
posted @ 2021-12-10 16:03 小基狠努力啊 阅读(35) 评论(0) 推荐(0) 编辑
摘要: 解构赋值正确使用的形式 1.函数的参数 2.函数的返回值 3.变量交换 4.JSON应用 5.Ajax请求应用 //函数的参数 解构赋值 // const sum = arr =>{ // let result = 0; // for(let i=0; i<arr.length;i++){ // r 阅读全文
posted @ 2021-12-10 11:39 小基狠努力啊 阅读(62) 评论(0) 推荐(0) 编辑
摘要: 学习es6里解构赋值的时候JSON应用的时候遇到Unexpected token o in JSON at position 1 这个错误 const json = {"name1":"es","price":"200"} const {name1,price} = JSON.parse(json) 阅读全文
posted @ 2021-12-10 11:29 小基狠努力啊 阅读(1504) 评论(0) 推荐(0) 编辑