Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Implementação Dr. Axel
- function findKeyAxel(object, callback, thisValue) {
- for (const [key, value] of Object.entries(object)) {
- if (callback.call(thisValue, value, key, object)) {
- return key;
- }
- }
- return undefined;
- }
- //Minha implementação
- function findKey(obj, callback){
- const key = Object.entries(obj).find(callback)[0];
- return ( key !== undefined ? key:undefined );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement