2021年1月13日

ES11 class的私有属性

摘要: class Person{ //公有属性 name; //私有属性(私有属性前面有#) #age; #weight; //构造方法 constructor(name, age, weight){ this.name = name; this.#age = age; this.#weight = we 阅读全文

posted @ 2021-01-13 16:44 家有糖果 阅读(168) 评论(0) 推荐(0)

ES10 flat 和flatMap

摘要: //flat 平 //将多维数组转化为低位数组const arr = [1,2,3,4,[5,6]]; const arr = [1,2,3,4,[5,6,[7,8,9]]]; //参数为深度 是一个数字console.log(arr.flat(2)); // 2代表深度 //flatMap con 阅读全文

posted @ 2021-01-13 16:33 家有糖果 阅读(92) 评论(0) 推荐(0)

babel把es6转换成es5并且打包

摘要: 1. 安装工具 npm i babel-cli @babel/preset-env browserify -D 2. 编译 npx babel src/js -d dist/js --presets=babel-preset-env 3. 打包 npx browserify dist/js/app. 阅读全文

posted @ 2021-01-13 10:42 家有糖果 阅读(220) 评论(0) 推荐(0)

导航