We should be able to see this on our website
I click on the jQuery CDN button to copy the line of code and then use the Ctrl+V shortcut to paste inside the head tag
This will take all the code from the words.html file and pass it to the data variable which we will print to the console.
We should see a weird script followed by the Scrabble dictionary
To do this we need to use a string function called split(), here's an example of how the function works:
Note: "\n" is referred as the new line character so therefore data will be split up whenever a new line is entered.
Check the official console by using the shortcut Ctrl+Shift+J:
Here's an example of me displaying the problem:
Here's an example of me displaying the problem with the first 19 lines being a script we don't want part of the dictionary:
Here's another picture displaying our problem:
The function slice needs a start index to now where to begin the slice (which is included) and it also needs an end index to know where to stop the slice (which is not included).
Add this code to index.html:
To do this we will need to check if each character in the string has an ASCII value between 97 and 122
Add this to the bottom of the index.js:
Add this code to the bottom of index.js:
Add this code inside the checkInput function:
We should now see the result appear on the website
In the next lesson we will learn about anagrams and how to find them
Created 2 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