You need to read all the keyboard key presses up until the Enter key is used.
You should output the typed word without the Enter key.
Wiring The Events
In order to listen to key presses, you will wire an event listener to the keypress event. That event listen to all key presses and in its handler you will store the key pressed (but won’t store the Enter key press). Here is an example for doing that:
In the example, you wire the keypress event. If the key press isn’t Enter (Enter key code is 13), you push the pressed key to a character array.
In order to catch the Enter key press and output the typed word, you will wire an event listener to the keyup event. That event listen to the end of key pressing (when the user stop pressing a key). Here is an example for wiring the event:
In the example, you wire the keyup event. If the key is released, you check whether the pressed key was Enter. If the key was Enter, you put the content of the characters array into a container div and you clear the array.
The Full Example
Here is all the code for the example: