Word in array counter

You’re using the assignment operator = instead of the equality operator ==:

Also you still need to splitTokens() your lyrics string so it becomes an array of words.

Only then you can count each word inside that array which matches string “imagine”.

2 Likes