JavaScript ES6 技巧
Tagged templates
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
Nullish coalescing operator (??)
How to conditionally add another object to an object?
const a = {
...(someCondition && {b: 5})
}
export default 是 Anonymous 的,所以不可以 export default const xxx
為什麼 { ...'' }
在 Firefox console 會報錯?
- 因為 Browser 把 {} 視為 block statement,而不是 object