2020年1月24日

摘要: //数组转换成对象 const arr = [['foo', 1],['bar', 2]] const obj = Object.fromEntries(arr) console.log(obj.bar) //找出key的长度为3的值 const obj = { abc: 1, def: 2, gh 阅读全文
posted @ 2020-01-24 15:51 bobo2404 阅读(136) 评论(0) 推荐(0)
 
摘要: let str = `"foo" and "bar" and "baz"` //方法一 function select (regExp, str) { const matches = [] while (true) { const match = regExp.exec(str) if(match 阅读全文
posted @ 2020-01-24 15:28 bobo2404 阅读(375) 评论(0) 推荐(0)
 
摘要: let str = ' foo ' //去除开头空格 console.log(str.trimLeft()) console.log(str.trimStart()) //去除尾部空格 console.log(str.trimRight()) console.log(str.trimEnd()) / 阅读全文
posted @ 2020-01-24 12:18 bobo2404 阅读(130) 评论(0) 推荐(0)