diff --git a/Background Color Changer/script.js b/Background Color Changer/script.js index ddb9b49f..677e1c5b 100644 --- a/Background Color Changer/script.js +++ b/Background Color Changer/script.js @@ -1,6 +1,31 @@ -var color= ["#222f3e","#f368e0","#ee5353","#6c55cc","#24ffff","#ff2626","#ffffff","#000000","#7878ff","#cdcdcd","#454545","#909090","#cccddd","#0abde3","#10ac84","#5f27cd"]; -var i=0; -document.querySelector("button").addEventListener("click",function(){ - i=1 { + if (i <= color.length - 2) { + i++; + document.body.style.background = `${color[i]}`; + } else { + i = 0; + document.body.style.background = `${color[i]}`; + } +});