Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Implementação Dr. Axel
  2. function findKeyAxel(object, callback, thisValue) {
  3.   for (const [key, value] of Object.entries(object)) {
  4.     if (callback.call(thisValue, value, key, object)) {
  5.       return key;
  6.     }
  7.   }
  8.   return undefined;
  9. }
  10.  
  11. //Minha implementação
  12. function findKey(obj, callback){
  13.     const key = Object.entries(obj).find(callback)[0];
  14.     return ( key !== undefined ? key:undefined );
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement