Hello everyone,
I need help to conceptually understand how to compare the following case:
Example:
- Paragraph is given: “Hello Ladies and gentlemen, welcome to my example” .
- User has to write the same sentence through input bar.
The first word the user types counts until user presses “Spacebar”.
Meaning, if user types Hellooooowe and hits space, the whole words is compared to the first word of the paragraph, i.e “Hello”.
Same for the rest, doesn’t matter how long the words is, it’s still compared to the next of order from pargarph.
My thoughts:
- To store both the given text and user’s values in two arrays.
- Whenever user press Space, the word he typed is added to array and compared with the text’s array. like
userArray[2] === textArray[2].
There is something I can’t understand though,
whenever user hits “backspace” - he can edit the previous word. how?
Copy & Splice the last word from array?
and if user deletes the word as well, he can access the word before that as well.
Sorry for overly complex text