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

ubuntu - How to disable Kernel Module Signing in linux -

java - Ebean enhancement ignores a model -

How to combine associative arrays in bash? -