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
Post a Comment