Skip to content

Instantly share code, notes, and snippets.

@fitsum
Last active April 26, 2024 05:06
Show Gist options
  • Save fitsum/03ccf8b780a325f20d4c9a5347fa012b to your computer and use it in GitHub Desktop.
Save fitsum/03ccf8b780a325f20d4c9a5347fa012b to your computer and use it in GitHub Desktop.
noaa.js
console.clear()
var latLon = '38.9031,-77.0507',
getForecastURL = 'https://api.weather.gov/points/' + latLon;
forecast = async (url) => {
//let r = await fetch(url);
let j = await (await fetch(url)).json();
j.properties.forecast ? forecast(j.properties.forecast) : console.table(j.properties.periods)
}
forecast(getForecastURL)
@fitsum
Copy link
Author

fitsum commented May 25, 2018

forecast() fires twice
step 1: gets URL for area forecast req
step 2: parse response from req

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment