JavaScript
if
const a = 1
const b = a ?? 0Spread Operator
let a = { name: 'a', age: 18 }
let b = {...a, tel: 123}
console.log(b) # {name: 'a', age:18, tel: 123}Rest Operator
primitive type
reference type
Redux
- action :
ES2015
- generator (* ออกเสียงว่า ซุปเปอร์สตาร์)
function *helloGenerator() {
}NPM
publish package
npm publish --access publicyarn
- yarn --force (npm rebuild)
async / await
heap out of memory
export NODE_OPTIONS=--max-old-space-size=8192Promise.all กับ for แล้ว await
- ถ้าใช้ Promise.all จะเรียกแบบ async ทั้งหมดแล้วค่อยรอ
- ถ้าใช้ for แล้ว await จะรอเสร็จทีละ 1 แล้วค่อยเรียกแบบ async
- https://weerasak.dev/posts/2023/03/07/javascript-promise-all-vs-for-await/