Skip to content

Commit

Permalink
Merge 48cc1a4 into 787ce5b
Browse files Browse the repository at this point in the history
  • Loading branch information
bishwasBhatta authored Jul 11, 2023
2 parents 787ce5b + 48cc1a4 commit 3a9d1e4
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions content/lessons/js3/sublesson/promises.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1036,12 +1036,8 @@ const fs = require('fs')
request('https://pokeapi.co/api/v2/pokemon/', (err, res, body) => {
const parsedJson = JSON.parse(body)
const nameArray = []
parsedJson.results.forEach(thisPokemon => {
nameArray.push(thisPokemon.name)
})
const names = nameArray.reduce((acc, thisName) => {
return `${acc}<h1>${thisName}</h1>`
const names = parsedJson.results.reduce((acc, pokemon) => {
return `${acc}<h1>${pokemon.name}</h1>`
}, '')
fs.writeFile('names.html', names, () => {})
})
Expand Down Expand Up @@ -1871,7 +1867,7 @@ The responses are raw, in chat format.
const titles = data.reduce((acc, f) => {
return `${acc}<h1>${f.title}</h1>`
}, '')
fs.writeFile('title.html', titles, () => {})
fs.writeFile('lessons.html', titles, () => {})
})
```
Expand Down

0 comments on commit 3a9d1e4

Please sign in to comment.