摘要:
//将多个对象合并到一个对象里 const input = { a: 1, b: 2 } const test = { d: 5 } const output = { ...input, ...test, c: 3 } //拆解对象,获取想要的属性 const input = { a: 1, b: 阅读全文
2020年1月23日
摘要:
const Gen = (time) => { return new Promise((resolve, reject) => { setTimeout(function () { if(time < 500) { reject(time) } else { resolve(time) } },ti 阅读全文
摘要:
function Gen (time) { return new Promise((resolve,reject) => { setTimeout(function () { resolve(time) },time) }) } async function test () { let arr = 阅读全文
摘要:
const data = { portLand: '78/50', Dublin: '88/52', Lima: '58/40' } Object.defineProperty(data, 'Lima', { enumerable: false, writable: false }) console 阅读全文
摘要:
//允许将空字符串或其他字符串添加到原始字符串的开头或结尾for(let i = 1; i < 32; i++) { if(i < 10) { console.log(`0{i}`) }else { console.log(i) } } for(let i = 1; i < 32; i++) { c 阅读全文
摘要:
let grade = { 'lilei' : 96, 'han' : 99 } //遍历keys console.log(Object.keys(grade)) console.log(Object.keys(grade).filter(item => item 'lilei')) //遍历val 阅读全文
摘要:
async function firstAsync () { return 27 //return Promise.resolve(27) } firstAsync().then(val => { console.log(val) }) console.log(firstAsync() instan 阅读全文
摘要:
//math.pow简写方法 console.log(2 ** 6) 阅读全文
摘要:
const arr = [1,2,3,4,5,6] console.log(arr.includes(4)) //true 阅读全文