摘要:
一。使用promisify(async 和await) (1)微信开发工具需要勾选增强编译 (2)需要引入@wepy/use-promiseify包,在入口文件app.wpy中 import promisify from '@wepy/use-promisify'; wepy.use(promisi 阅读全文
该文被密码保护。 阅读全文
摘要:
用来确定一个字符串是否包含在另一个字符串中 原来,JavaScript 只有indexOf方法 返回index ES6 又提供了三种新方法includes(), startsWith(), endsWith()返回布尔值,但是使用第二个参数n时,endsWith的行为与其他两个方法有所不同。它针对前 阅读全文
摘要:
Iterator 的作用有三个: 一是为各种数据结构,提供一个统一的、简便的访问接口; 二是使得数据结构的成员能够按某种次序排列; 三是 ES6 创造了一种新的遍历命令for...of循环,Iterator 接口主要供for...of消费。 阅读全文
摘要:
数组的解构 ES6 允许按照一定模式,从数组和对象中提取值,对变量进行赋值,这被称为解构 默认值:解构赋值允许指定默认值 (1)(ES6 内部使用严格相等运算符( ),只有当一个数组成员严格等于undefined,默认值才会生效) let [x, y = 'b'] = ['a']; // x='a' 阅读全文
摘要:
let 1.块级作用域(ES5 只有全局作用域和函数作用域) (1).只在let命令所在的代码块内有效(for)。 var a = []; for (let i = 0; i < 10; i++) { a[i] = function () { console.log(i); }; } a[6](); 阅读全文
摘要:
//选中除了最后一个div div:not(:last-child) { } //选中除了第一个div div:not(:first-child) { } //选中前两个 div:nth-child(-n+2) { } //选中除了前两个 div:nth-child(n+2) { } 使用公式 (a 阅读全文
摘要:
对象进行合并 var a={a:'1'}; var b = {b: '2'}; Object.assign(a,b); a {a: "1", b: "2"} b {b: "2"} 或 var c= Object.assign({},a,b); c {a: "1", b: "2"} 对数组进行合并 v 阅读全文
摘要:
字符串自动补全padStart()、padEnd() 阅读全文
摘要:
报错原因 : 初始值赋值为null 解决方法: 初始值赋值为{} 阅读全文