2020年1月23日

摘要: //将多个对象合并到一个对象里 const input = { a: 1, b: 2 } const test = { d: 5 } const output = { ...input, ...test, c: 3 } //拆解对象,获取想要的属性 const input = { a: 1, b: 阅读全文
posted @ 2020-01-23 23:19 bobo2404 阅读(328) 评论(0) 推荐(0) 编辑
 
摘要: const Gen = (time) => { return new Promise((resolve, reject) => { setTimeout(function () { if(time < 500) { reject(time) } else { resolve(time) } },ti 阅读全文
posted @ 2020-01-23 22:36 bobo2404 阅读(205) 评论(0) 推荐(0) 编辑
 
摘要: function Gen (time) { return new Promise((resolve,reject) => { setTimeout(function () { resolve(time) },time) }) } async function test () { let arr = 阅读全文
posted @ 2020-01-23 22:21 bobo2404 阅读(892) 评论(0) 推荐(0) 编辑
 
摘要: const data = { portLand: '78/50', Dublin: '88/52', Lima: '58/40' } Object.defineProperty(data, 'Lima', { enumerable: false, writable: false }) console 阅读全文
posted @ 2020-01-23 21:13 bobo2404 阅读(206) 评论(0) 推荐(0) 编辑
 
摘要: //允许将空字符串或其他字符串添加到原始字符串的开头或结尾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 阅读全文
posted @ 2020-01-23 20:55 bobo2404 阅读(122) 评论(0) 推荐(0) 编辑
 
摘要: let grade = { 'lilei' : 96, 'han' : 99 } //遍历keys console.log(Object.keys(grade)) console.log(Object.keys(grade).filter(item => item 'lilei')) //遍历val 阅读全文
posted @ 2020-01-23 20:38 bobo2404 阅读(274) 评论(0) 推荐(0) 编辑
 
摘要: async function firstAsync () { return 27 //return Promise.resolve(27) } firstAsync().then(val => { console.log(val) }) console.log(firstAsync() instan 阅读全文
posted @ 2020-01-23 20:15 bobo2404 阅读(91) 评论(0) 推荐(0) 编辑
 
摘要: //math.pow简写方法 console.log(2 ** 6) 阅读全文
posted @ 2020-01-23 19:32 bobo2404 阅读(118) 评论(0) 推荐(0) 编辑
 
摘要: const arr = [1,2,3,4,5,6] console.log(arr.includes(4)) //true 阅读全文
posted @ 2020-01-23 19:26 bobo2404 阅读(314) 评论(0) 推荐(0) 编辑
 
摘要: //导出 //方式一 export const name = 'hello' export let addr = 'chengdu' export var list = [1,2,3] //方式二 const name = 'hello' let addr = 'chengdu' var list 阅读全文
posted @ 2020-01-23 19:18 bobo2404 阅读(158) 评论(0) 推荐(0) 编辑