String.replaceAll()
: 모든 문자열을 대체함// 🎵 모든 'l'을 '~'로 바꾸지
const str = "Hello World"
console.log(str.replace(/l/g, "~"));
// ↓
console.log(str.replaceAll("l", "~"));
// ⬇️ Output
// He~~o Wor~d
Promise.any
: Promise.race
는 promise 중 가장 먼저 완료된 결과 값으로 이행/거부하는 반면, Promise.any
는 promise 중 가장 먼저 이행된 객체 반환
Logical Assignment Operators
// 🎵 논리할당연산자 줄여쓰기
num1 = num1 || 0;
num2 ||= 0; // 'num2 = num2 || 0'을 바꿔서 쓴 것
// ↓ 이렇게 쓸 수도 있음
num1 ||= 0;
num2 ||= 0;
name = name && `Hello ${name}`;
// ↓
name &&= `Hello ${name}`;
let billion = 1_000_000_000
billion // 100000000