How do I return the response from an asynchronous call?
I’m trying to convert a small (single page) PHP app to Javascript but having trouble accessing the contents of the JSON file. I think it’s down to how I’ve written the JS, but as an example: async function fetchLocalFile(filePath) { try { const response = await fetch(filePath); if (!response.ok) { throw new Error(`HTTP error! status: