fork download
  1. function find(object, path){
  2. let result;
  3. try{
  4. let myPath = path.split(".");
  5. result = object;
  6. myPath.forEach(function(element) {
  7. if(result.hasOwnProperty(element)){
  8. result = result[element];
  9. }else{
  10. result = undefined;
  11. }
  12. });
  13. }catch(e){
  14. result = undefined;
  15. }
  16. return result;
  17. }
Success #stdin #stdout 0.02s 10312KB
stdin
Standard input is empty
stdout
Standard output is empty