+ 3
ODLNT
You're right about that. But too bad I'm not clearly understanding OP's actual intention for output ...
If 1st textarea contains "hi", and 2nd textarea contains "h" then the expected output will be "hi". This part is rather confusing as to how and why : )
* OP deleted original code. Relevance is gone, better leave this now.
+ 2
<result> is an object, convert it to string first before splitting
... .innerHTML = result.toString().split( " " );
+ 2
Ipang does the String method match return an object or an array?
+ 2
ODLNT
An array, as per MDN
https://developer.mozilla.org/id/docs/Web/JavaScript/Reference/Global_Objects/String/match
But logging `typeof result` in console shows 'object', as usual ...
+ 2
Ipang As you already know all arrays are objects...
I would suggest using the Array method join since match returns an array.
+ 2
Your Mom
adding keyboard events:
https://openjavascript.info/2022/03/04/adding-keyboard-input-event-in-javascript/