Skip to content

initial commit#214

Open
areebakwas wants to merge 1 commit intoprojectshft:masterfrom
areebakwas:master
Open

initial commit#214
areebakwas wants to merge 1 commit intoprojectshft:masterfrom
areebakwas:master

Conversation

@areebakwas
Copy link

No description provided.

</head>
<body>
<div class="container">

Choose a reason for hiding this comment

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

remove empty spaces

Comment on lines +21 to +23



Choose a reason for hiding this comment

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

no need for empty spaces, affects the code flow

// create eventlistener and variable

document.getElementById('button-search').addEventListener('click', function() {
let townName = document.getElementById('current-town').value;

Choose a reason for hiding this comment

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

why let ? this is should be a const, check ES6 best practices

// create eventlistener and variable

document.getElementById('button-search').addEventListener('click', function() {
let townName = document.getElementById('current-town').value;

Choose a reason for hiding this comment

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

here is where you are missing the empty input validation. Very important to consider, or your app will crash


document.getElementById('button-search').addEventListener('click', function() {
let townName = document.getElementById('current-town').value;

Choose a reason for hiding this comment

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

empty spaces

Comment on lines +14 to +22
const apiKey = '63168e96197ab571649bdefbef398926';
const currentWeatherApiUrl = `https://api.openweathermap.org/data/2.5/weather?q=${townName}&units=imperial&appid=${apiKey}`;
//create fetch to grab data, add error check as well
fetch(currentWeatherApiUrl)
.then(response => response.json())
.then(data => {
showPresentWeather(data);
predictClimate(townName, apiKey)
})

Choose a reason for hiding this comment

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

your code alignment is off

//create fetch to grab data, add error check as well
fetch(currentWeatherApiUrl)
.then(response => response.json())
.then(data => {

Choose a reason for hiding this comment

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

be more descriptive, data tells not much,

Suggested change
.then(data => {
.then(weatherData => {

}
//create fxn fivedayweather

function fiveDayWeather(data) {

Choose a reason for hiding this comment

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

use arrow functions next time


//find last town searched and save
document.getElementById('button-search').addEventListener('click', function() {
let townName = document.getElementById('current-town').value;

Choose a reason for hiding this comment

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

why let?


});
window.onload = function() {
let previousTown = localStorage.getItem('previousTown');

Choose a reason for hiding this comment

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

again, should be const

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