Files
30-seconds-of-code/test/findLastKey/findLastKey.js

5 lines
127 B
JavaScript

const findLastKey = (obj, fn) =>
Object.keys(obj)
.reverse()
.find(key => fn(obj[key], key, obj));
module.exports = findLastKey