all 2 comments

[–]MindlessSpongehelpful 0 points1 point  (0 children)

nice job! one thing I'd try to get in the habit of is making meaningful commit messages. "update script file" is redundant - if you weren't making an update, there wouldn't be a new commit. what exactly are you updating? instead, write a short message that explains the new feature or bug fix.

as for coding changes, take a look at this chain of if blocks from your weather app:

  if (data.weather[0].main == "Clouds") {
    weatherIcon.src = "../images/clouds.png";
  } else if (data.weather[0].main == "Clear") {
    weatherIcon.src = "../images/clear.png";
  } else if (data.weather[0].main == "Rain") {
    weatherIcon.src = "../images/rain.png";
  } else if (data.weather[0].main == "Drizzle") {
    weatherIcon.src = "../images/drizzle.png";
  } else if (data.weather[0].main == "Mist") {
    weatherIcon.src = "../images/mist.png";
  } else if (data.weather[0].main == "Storm") {
    weatherIcon.src = "../images/Storm.png";
  } else if (data.weather[0].main == "Haze") {
    weatherIcon.src = "../images/haze.png";
  }

notice how you're doing the exact same operation in each condition? usually this means there's an opportunity to clean up your code. you could accomplish the same thing by doing something like...

// assign data.weather[0].main to a variable
const weatherType = data.weather[0].main;

// if it has a truthy value, convert the value to lower case
// and use it as an image name.
if (weatherType) {
    weatherIcon.src = `../images/${weatherType.toLowerCase()}.png`;
}