Basic Web development tutorial with implementing a simple Weather Forecast service. (For beginner)

HTML

API

DOM Manipulation

#box indicates a tag which has an ID as 'box'
.box means tags which has class as 'box'
div means every div tags under this document

To call API

  • End point URL
  • API KEY
  • City Name
c.f. A shape of object
response => response.json() 
(response) => {
return response.json()
}
let response = fetch('http://....')
let data = response.json()
console.log(data)

Asynchronous works

let response = fetch('http://....')
let data = response.json()
console.log(data)

Promise, Await, Async

function heavyWorks (param) {
return new Promise(res, rej){
// res() or rej()
}
}
let result = await heavyWorks(param)
async function mainWorks(){
let result = await heavyWorks(param)
//...
}

Full of code

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Fredric Cliver

Fredric Cliver

119 Followers

Majored in Physics, self-taught and worked in the IT industry as a Dev/Design/Planning for 11 years. And I had run my Startup for 3 years. I fancy a ☔️ 🇬🇧