Change background color (gradient) using HTML CSS & JS

preview_player
Показать описание
********************************music*********************************

*******************************More********************************
********************************************************************
Рекомендации по теме
Комментарии
Автор

Here''s the code
const colors = [
"red", "pink", "blue", "#663399", "yellow", "black"
];
const btnEl =
const color =

btnEl.addEventListener('click', ()=>{
const randomColor = randomColorfunc();
let color1 = colors[randomColor];
const rand = randomColorfunc();
let color2 = colors[rand];
gradient = 'linear-gradient(to left'+', '+color1+', '+color2+')';

= gradient;
color.textContent = colors[randomColor];
})

function randomColorfunc(){
return Math.floor(Math.random() * colors.length);
}

Miladah
join shbcf.ru