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

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -