can you help me with this code. I wanna to create guessing game, where user should put a right color in prompt.
Computer guesses - a color, and user should give a right answer - which color is correct. I try to create a right code for it but is does not work correctly. Maybe the problem with variables or with indexOf, or smth else.... Thank you in advanced
    var target;
    var guess_input;
    var finished = false;
    var colors;  
    var presentOrNot;
    colors = ["aqua", "black", "white"];
    function do_game() {
        var random_color = colors[Math.floor(Math.random() * colors.length)];
        target = random_color; 
        alert (target);
        while (!finished) {
            guess_input = prompt("I am thinking of one of these colors:\n\n" + colors + "\n\n What color am I thinking of?");
            guesses += 1;
            finished = check_guess ();
        }
    }
    function check_guess () {
        presentOrNot = colors.indexOf(guess_input);
        if (presentOrNot == target) {
            alert ("It is my random color");
            return true;
        }
        else {
            alert("It isn't my random color");
            return false;
        }
     }
 
     
     
     
    