So I have been learning javascript for two months now and I'm doing some precourse work and got stuck on this question. I know I need a for a loop. but I am completely lost and there doesn't seem to be a comparable problem anywhere to learn from. the problem is://Given a string, write a program that counts how many colors are used in that string. For the purposes of our challenge, let's say all the available colors are: blue, green, gray, red, black, and purple.
So here is the code I have so far
//declaring values and user input
const colors = ["blue", "green", "gray", "red", "black", "purple"];
const sillySentence = prompt("Tell me a colorful Rhyme: ");
//for loop to solve the problem
//start output
console.log("You Listed " + x + " colors in your rhyme.")