2021年1月12日

ES6 模块的导出和导入

摘要: <script type="module"> //1. 通用的导入方式 //引入 m1.js 模块内容 // import * as m1 from "./src/js/m1.js"; // //引入 m2.js 模块内容 // import * as m2 from "./src/js/m2.js 阅读全文

posted @ 2021-01-12 17:43 家有糖果 阅读(148) 评论(0) 推荐(0)

ES6对象的扩展方法

摘要: // Object.is 判断两个值是否完全相等 console.log(Object.is(120, 120)) // true 和 很像 // 区别 console.log(Object.is(NaN, NaN)) console.log(NaN NaN) // Object.assign 对象 阅读全文

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

ES6数值扩展

摘要: // Number.EPSILON 是js表示的最小精度 console.log(0.1 + 0.2) function equal (a, b) { if (Math.abs(a-b) < Number.EPSILON) { return true } else { return false } 阅读全文

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

ES6 class 继承

摘要: class Phone { constructor(brand, price) { this.brand = brand this,price = price } call () { console.log('我可以打电话') } } class SmartPhone extends Phone { 阅读全文

posted @ 2021-01-12 15:35 家有糖果 阅读(35) 评论(0) 推荐(0)

导航