Open LionOnTheWeb opened 1 year ago
ChatGPT response for reference:
const gameBoard = document.querySelector('#game-board');
const colors = ['red', 'green', 'blue', 'yellow'];
let computerSequence = [];
let playerSequence = [];
let level = 1;
function generateRandomSequence(level) {
for(let i = 0; i < level; i++) {
const randomIndex = Math.floor(Math.random() * 4);
computerSequence.push(colors[randomIndex]);
}
return computerSequence
}
console.log(generateRandomSequence(1));
Overview
Create a function that generates a sequence based on the predefined colors array. See ChatGPT response in the comment below
Tasks