Created
March 3, 2018 22:53
-
-
Save wesdeveloper/932bc42dc5f6863187c3727792dae4d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const channels = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"]; | |
const colorsListItem = ["--yellow", "--coral", "--purple"]; | |
// Showing channel names and adding colored item | |
for(i=0;i<channels.length;i++){ | |
// Creating random value for item color | |
function randomColor(){ | |
number = Math.floor(Math.random()*colorsListItem.length); | |
color = colorsListItem[number]; | |
return color ; | |
}; | |
const color = randomColor(); | |
$('#list').append( | |
'<li class="listItem" style="background-color:var('+ color +')"><p>' +channels[i]+ '</p></li>' | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment