When I separate files (HTML and JS) and link the JS file to the HTML (as is expected), everything works just fine. However, when I include the JS code inside the `<script>` tags in the HTML code, it doesn't work as expected. Nothing happens after I enter any of the items included in the array, even though it is supposed to check for the condition in question. 

**HTML Code:**

```
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Color Guessing Game</title>
    <script src="Week 2 Part 1.js" type="text/javascript"></script>
</head>
<body>
    <p onload="colorGame()"></p>
</body>
</html>

```

**JS Code:**

```
let myColors = ["red", "purple", "blue", 
"orange", "violet", "green", 
"amber", "deep ruby", "lemon chiffon", 
"old lace", "lime", "yellow", "chartreuse", 
"deep taupe", "wheat", "deep pink", 
"amethyst", "beige", "turquoise"];

let yourColor = prompt("I am thinking of one of these colors:\n\n" +    myColors.sort() + "\n\nWhat color am I thinking of?");

function yourGuessedColor() {
    while(myColors.indexOf(yourColor) <= -1) {
        alert("Sorry, I don't recognize your color.\n\nPlease try again.");
        yourColor = prompt("I am thinking of one of these colors:\n\n" +  myColors.sort() + "\n\nWhat color am I thinking of?");
    }
    return yourColor;
}

let guessedColor = yourGuessedColor();
let myFavColor = myColors[Math.floor(Math.random() * myColors.length)];
let guesses = 1;
function colorGame() {
    while (guessedColor != myFavColor) {
        if (guessedColor > myFavColor) {
            alert("Sorry, your guess is not correct!\n\nHint: your color is alphabetically higher than mine.\n\nPlease try again.");
            guessedColor = prompt("I am thinking of one of these colors:\n\n" + myColors.sort() + "\n\nWhat color am I thinking of?");
        }
        else {
            alert("Sorry, your guess is not correct!\n\nHint: your color is alphabetically lower than mine.\n\nPlease try again.");
            guessedColor = prompt("I am thinking of one of these colors:\n\n" + myColors.sort() + "\n\nWhat color am I thinking of?");
        }
        guesses ++;
    }
    return alert("Congratulations! You have guessed the color!\n\nIt took you " + guesses + " guesses to finish the game.\n\nYou can see the color in the background.")
}

```