I've tried to see if there were any scripts to convert a list of words into an array and I can't seem to find one.
Anyone know where I can find one?
Input:
Dog
Cat
Hamster
Gets converted to
["Dog", "Cat", "Hamster"]
Noo.. this isn't what I mean. I have a txt file with a bunch of words on each line and I was wondering if there was something out there already created that can convert each word into an array.
If the string is actually
"Dog\nCat\nHamster"
then just doFor a TextArea try this
Where
myTextArea
is the TextArea you can get usinggetElement
.I think the best solution for a
textarea
input is using thematch()
function of javascript like this:here a fiddle of it working.
This doesn't need for the words to be in different lines.
Just use
split
on the string.For example:
Demo