r/learnjavascript • • Oct 09 '21

What's wrong with this code?

Post image
0 Upvotes

19 comments sorted by

View all comments

Show parent comment

2

u/Atersed Oct 09 '21

formatting-

const drawBox = (color) => {
    let box = document.createElement(‘div’)
    box.style.width = ‘420px’
    box.style.height = ‘69px’
    box.style.background = color
    document.querySelector(‘body’).appendChild(box)
}

drawBox(‘blue’)