Implement mapValues(obj, fn)
Write mapValues(obj, fn), like Array.prototype.map, but for an object's values, keeping the same keys. fn receives (value, key).
mapValues({ a: 1, b: 2 }, (v) => v * 10); // { a: 10, b: 20 }Loading compiler resources...
mapValues(obj, fn)Write mapValues(obj, fn), like Array.prototype.map, but for an object's values, keeping the same keys. fn receives (value, key).
mapValues({ a: 1, b: 2 }, (v) => v * 10); // { a: 10, b: 20 }Run your code to see results.
This interactive challenge requires a DeepFrontend Pro membership. Get instant access to write, execute, test, and view verified solution code directly in your browser.
Regional pricing available • Instant access
Stuck? This challenge exercises: