Object.entries
Object.entries()
メソッドは、引数に与えたオブジェクトが所有する、列挙可能なプロパティの組 [key, value] からなる配列を返す。
example.jsconst people = { yamada: 23, tanaka: 30 }; console.log(Object.entries(people)) // output // Array [Array ["yamada", 23], Array ["tanaka", 30]] for (let [key, value] of Object.entries(people)) { console.log(`${key}さんは ${value} 才です`); } // output // "yamadaさんは 23 才です" // "tanakaさんは 30 才です"