Bohrern Sie in den Baum, um Schlüssel JavaScript zu finden

let search = (needle, haystack, found = []) => {
  Object.keys(haystack).forEach((key) => {
    if(key === needle){
      found.push(haystack[key]);
      return found;
    }
    if(typeof haystack[key] === 'object'){
      search(needle, haystack[key], found);
    }
  });
  return found;
};
Jittery Jaguar