I'm working in get a list from a local file. But the folder sometimes can change. So come here to ask you guys if it's correct, because I think there is a better way to do it, idk. Please help me :)
  fetch("./myJson.json")
     .then(res => { 
        if(res.status != 404)
           res.json() 
        else
           fetch("../myJson.json")
              .then(res => res.json())
              .then(data => console.log(data))
              .catch(err => console.error(err));
     })
     .then(data => console.log(data))
     .catch(err => console.error(err));
Thanks!
 
    