It will also show anagrams that have less amount of letters than the input such as this example:
We go through each letter for a potential anagram word and make sure it can cross out a letter from the input that isn't already crossed out.
Here's an example of the function indexOf returning the number 2 to indicate the index of the letter "R" in the array:
If there is no index then the function will return -1, as shown in this example:
You do NOT need to copy the green lines because they are comments and only there to help explain each line of code.
Also this code should at the bottom of index.js:
To test the function add two console.log lines at the bottom of your code and check the console
This should go inside index.js:
Add this line of code inside the checkInput function:
The code should be checking if the input and the potential anagram word are EQUAL to each other.
Add this to index.js:
This should appear for the "anagrams" example:
The hidden code should be checking if the certain anagram word's length is equal to the certain length category.
Created 6 months ago
Teach coding to your students with MVCode Teach
MVCode offers an integrated product designed to teach coding to students.
Learn more about MVCode Teach