search finder | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

search finder

theres 2 textareas. u put some text in one textarea, now the 2nd textarea is where the magic happens, for example if i put the word "hi" in the first textarea, and the seconds says the letter "h" i want it to output "hi", my split is not working u know why? https://code.sololearn.com/WYyDD611cvN4

30th Aug 2022, 1:30 AM
Junior
Junior - avatar
7 Answers
+ 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.
30th Aug 2022, 7:43 PM
Ipang
+ 2
<result> is an object, convert it to string first before splitting ... .innerHTML = result.toString().split( " " );
30th Aug 2022, 3:57 AM
Ipang
+ 2
Ipang does the String method match return an object or an array?
30th Aug 2022, 1:40 PM
ODLNT
ODLNT - avatar
+ 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 ...
30th Aug 2022, 2:47 PM
Ipang
+ 2
Ipang As you already know all arrays are objects... I would suggest using the Array method join since match returns an array.
30th Aug 2022, 5:08 PM
ODLNT
ODLNT - avatar
0
u know ctrl + f? pretty much that. anyways how do i make it so when u backspace it gets rid of what u put?
30th Aug 2022, 8:44 PM
Junior
Junior - avatar