Dev Helpers
← Back

Map object values

Map object values. A self-contained example using the JavaScript runtime.

Open this example in the interactive library

Source code

const prices = { book: 10, pen: 2 };
console.log(
  Object.fromEntries(
    Object.entries(prices).map(([k, v]) => [k, v * 1.13]),
  ),
);

Sample output

{ book: 11.299999999999999, pen: 2.26 }