Request1#234
Open
bdworkman31 wants to merge 7 commits into
Open
Conversation
| document.body.style.backgroundColor = "white"; | ||
| } | ||
|
|
||
| let currentTemplate = `<div class = "row current-weather mb-4"> |
| })); | ||
|
|
||
| //Change Styling Based on Current Weather w/ Switch Statement | ||
| switch (weather.condition) { |
There was a problem hiding this comment.
this can be extracted to a method, no need to redefine it every time you call this function
|
|
||
| fetchWeather(city); | ||
|
|
||
| document.querySelector("#search-query").value = ""; |
There was a problem hiding this comment.
if requests fails, this is a bad experience
| const fetchWeather = (...args) => { | ||
| let url; | ||
|
|
||
| if (args.length === 1) { |
There was a problem hiding this comment.
before this, need to trim the args.
| return mode[0][0]; | ||
| }; | ||
|
|
||
| const fetchWeather = (...args) => { |
There was a problem hiding this comment.
its not good to pass args like this with 2 different types of arguments.
Define both and then check if passed, or wrap in a different method to make it more readable.
Suggested change
| const fetchWeather = (...args) => { | |
| const fetchWeather = (city, coordinates) => { |
| }; | ||
|
|
||
| //Find the mode of each nested Array | ||
| const mode = (array) => { |
There was a problem hiding this comment.
not clear what mode is referring to.
| .then((data) => { | ||
| addCurrentWeather(data); | ||
|
|
||
| const urlForecast = `https://api.openweathermap.org/data/2.5/forecast?lat=${data.coord.lat}&lon=${data.coord.lon}&appid=d408f27efbf2eb54ef2bd39871d4fe8b`; |
There was a problem hiding this comment.
if data changed, your code will crash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.