オブジェクトの[キー, 値]ペアの配列を返します。
문법
Object.entries(obj): [string, unknown][]예제
아래 값을 입력하면 예제에 즉시 반영됩니다.
const→prices→apple→banana→cherry→doubled→Object→fromEntries→entries→map→const prices = { apple: 1.5, banana: 0.5, cherry: 3.0 };
const doubled = Object.fromEntries(
Object.entries(prices).map(([k, v]) => [k, v * 2])
);
// { apple: 3, banana: 1, cherry: 6 }