Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paper: Saejin #65

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Paper: Saejin #65

wants to merge 6 commits into from

Conversation

saebaebae
Copy link

@saebaebae saebaebae commented Jun 18, 2021

No description provided.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done Saejin, you hit the learning goals here. I left a few minor notes, but this is quite well done.

} else if (tempState.temp >= 50) {
return landscape.textContent = "Grab yah coat";
} else if (tempState.temp <= 49) {
return landscape.textContent = "Betta warm up the cah";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very.... Boston of you

Comment on lines +8 to +23
const hotter = (event) => {
tempState.temp +=1;
temperature.textContent = `${tempState.temp}F`;
temperature.style.color = tempColor();
checkLand();
landText();
};

const colder = (event) => {
tempState.temp -=1;
// const landscape = document.querySelector("#landscapeContainer");
temperature.textContent = `${tempState.temp}F`;
temperature.style.color = tempColor();
checkLand();
landText();
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of notes:

  1. You're not using the event parameter so you can drop it.
  2. You can combine these functions into one.
Suggested change
const hotter = (event) => {
tempState.temp +=1;
temperature.textContent = `${tempState.temp}F`;
temperature.style.color = tempColor();
checkLand();
landText();
};
const colder = (event) => {
tempState.temp -=1;
// const landscape = document.querySelector("#landscapeContainer");
temperature.textContent = `${tempState.temp}F`;
temperature.style.color = tempColor();
checkLand();
landText();
};
const changeTemp = (increment) => {
tempState.temp += increment;
temperature.textContent = `${tempState.temp}F`;
temperature.style.color = tempColor();
checkLand();
landText();
};

Then you can use an anonymous function to call it when you register the event handlers.

    colderButton.addEventListener("click", () => changeTemp( -1 ) );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants