Javascript: Split File into an Array -


i have list of english words in text file. create array file separated words:

var dictionarywords = ["apple","orange","banana","strawberry"] 

how can use in javascript? , please try explain in beginner terms since i'm still new this! thanks!

if have file contents in variable, use split() method split array:

var dictionary = file_contents.split("\n"); 

\n newline character.

you can use ajax read file server javascript variable. there many ajax tutorials on web, i'm not going try teach here.


Comments

Popular posts from this blog

php - How can an email be returned from Stripe Checkout? -

SQL php on different pages to Insert (mysqli) -

linked list - Get the index of the Node in a LinkedList which contains the given value in java -