(location)
| 1 | const getWeather = (location) => { |
| 2 | // chose a random temperature and condition |
| 3 | const randomTemperature = Math.floor(Math.random() * (80 - 50 + 1)) + 50; |
| 4 | const randomConditionIndex = Math.floor(Math.random() * 5); |
| 5 | const conditions = ["Cloudy", "Sunny", "Rainy", "Snowy", "Windy"]; |
| 6 | |
| 7 | return { |
| 8 | location: location, |
| 9 | temperature: randomTemperature, |
| 10 | unit: "F", |
| 11 | conditions: conditions[randomConditionIndex], |
| 12 | }; |
| 13 | }; |
| 14 | |
| 15 | export { getWeather }; |
no outgoing calls
no test coverage detected