Fazza Razaq Amiarso• 2,340
@fazzaamiarso
Posted
Hi Franco, Great work!
A tip from me for cleaner or more readable code is by breaking-up your createCard DOM creation into functions. for example
const createImageContainer = (image) => {
let containerImage = document.createElement('div')
containerImage.setAttribute('style',`background: url("${image}") center no-repeat;background-size: cover;`)
let containerTitle = document.createElement('div')
let containerDetail = document.createElement('div')
}
const createHeader = title => {
let h1 = document.createElement('h1')
let contentT = document.createTextNode(title)
}
//in createCard you just need to do this
const createCard = (image,title,population,region,capital) => {
createHeader(title);
createImageContainer(image);
//other codes
}
I hope it helps! Cheers!
Marked as helpful
1
Franco Bernardi• 150
@francobernardii
Posted
@fazzaamiarso Thank you so much Fazza, I'll update my date with your recomendations.
Cheers!
0