Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const colors = [
- "red", "green", "blue", "purple",
- "yellow", "pink", "orange", "brown",
- "teal", "aqua", "cyan", "navy",
- "red", "green", "blue", "purple",
- "yellow", "pink", "orange", "brown",
- "teal", "aqua", "cyan", "navy",
- ];
- let fields = document.getElementsByClassName("field");
- fields = [...fields];
- fields.pop();
- const coloring = function () {
- for (let i = 0; i <= 23; i++) {
- console.log(i);
- fields[i].style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
- console.log(colors.splice(i, 1));
- }
- }
- coloring();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement