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

weather app #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jeli1991
Copy link

No description provided.

Copy link

@chezzoba chezzoba left a comment

Choose a reason for hiding this comment

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

Nicely done, just remember what we learned about API keys and using JSON files.

"stadium": "Old Trafford",
"founded": 1878
},
{
Copy link

Choose a reason for hiding this comment

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

I would put this in an actual .json file and import it if needed. Now it is useless.

const options = {
method: 'GET',
headers: {
'X-RapidAPI-Key': '08b2e4a664msh162c459a452cb14p1e70a3jsnd054693f2b71',
Copy link

Choose a reason for hiding this comment

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

Hide the API key

@@ -0,0 +1,50 @@

const apiKey="3975e1c2286a8c534bd280117c6b3ebe";
Copy link

Choose a reason for hiding this comment

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

Same here




async function checkweather(city){
Copy link

Choose a reason for hiding this comment

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

Nicely done

const sunset = data.sys.sunset;

document.querySelector(".city").innerHTML= data.name;
document.querySelector(".temp").innerHTML= Math.round(data.main.temp) + "°c";
Copy link

Choose a reason for hiding this comment

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

Use innerText or textContent

document.querySelector(".city").innerText = data.name;
document.querySelector(".temp").innerText = Math.round(data.main.temp) + "°c";
document.querySelector(".wind").innerText = data.wind.speed + "km/h";
document.querySelector(".sunset").innerText = new Date(sunset * 1000).toString();

} )

searchbox.addEventListener("keydown", (event) => {
if (event.keyCode === 13) {
Copy link

Choose a reason for hiding this comment

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

Cool keyboard shortcut

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