diff --git a/js/script.js b/js/script.js index 803c165..77b7485 100644 --- a/js/script.js +++ b/js/script.js @@ -1,12 +1,12 @@ //Choose a random color -const button = document.querySelector('button') -const body = document.querySelector('body') -const colors = ['red', 'green', 'blue', 'yellow', 'pink', 'purple'] +const button = document.querySelector('button'); +const body = document.querySelector('body'); +const colors = ['#ff0000', '#3cb371', '#0000ff', '#ffa500', '#ff6375', '#6a5acd']; -body.style.backgroundColor = 'violet' -button.addEventListener('click', changeBackground) +body.style.backgroundColor = 'violet'; +button.addEventListener('click', changeBackground); function changeBackground(){ -const colorIndex= parseInt(Math.random()*colors.length) -body.style.backgroundColor = colors[colorIndex] +const colorIndex= parseInt(Math.random()*colors.length); +body.style.backgroundColor = colors[colorIndex]; }