- 早安,所有善良而勇敢的人们
- 坏人们,颤抖吧
关掉 vue has been registered but not used
package.json 的 eslintConfig(如果已经有 eslintrc.js )
1 | "rules": { |
clone object 三种
1 | let a = {a:1,b:{c:{d:2}}} |
via https://www.samanthaming.com/tidbits/70-3-ways-to-clone-objects/
padStart
1 | const purchase = [ |
两头对齐
1 | Masks 9.99 |
1 | const bankNumber = '2222 2222 2222 2222'; |
类似滴:
- trimStart(trimLeft) 去除前空格
- trimEnd(trimRight) 去除后空格
- trim() 去除前后空格
shadow copy
- spread operator {…} […]
- array slice
- Object.assign
- Array.from
deep copy
deep copy (or deep clone): lodash _.cloneDeep, Ramda, a custom function, JSON.parse() / JSON.stringify(), and rfdc
For the best performance, the library rfdc (Really Fast Deep Clone) will deep copy about 400% faster than lodash’s _.cloneDeep