摘要:
let options = { title: 'menu', width: 100, height: 200 } //如果简写,变量名必须和属性名一致 let {title,width,height} = options console.log(title,width,height) let {ti 阅读全文
2020年1月18日
摘要:
//数组解构 let arr = [1,2,3,4,5,6,7] let [one,two] = arr let [one, , ,four] = arr console.log(one,two,four) let arr = 'abcd' let [first, ,third] = arr con 阅读全文
摘要:
//包含变量或表达式 const a = 10 const b = 20 const c = 'html' const str = `my age is ${a + b} i love ${c}` //包含逻辑运算的用法 function Price (strings,type){ let s1 = 阅读全文
摘要:
const s = 'aaa_aa_a' const r1 = /a+/g const r2 = /a+/y console.log(r1.exec(s)) //aaa console.log(r2.exec(s)) //aaa console.log(r1.exec(s)) //aa consol 阅读全文
摘要:
const target = { a: { b: { c: { d: 1 } }, e: 5, f: 6, h: 10 } } const source = { a: { b: { c: { d: 1 } }, e: 2, f: 3 } } Object.assign(target, source) 阅读全文