Jump to content

JavaScript and RandomWord


letsjustbereal

Recommended Posts

Hello,

I want to create a RandomWord program in JavaScript.

You click on the screen and a new random word appear on screen.

For this I need a complete list of all English words (which I have).

 

Now the most stupid idea would be to copy all those words into a file, and putting everything into an array and access the array with Math.random.. but it would take AGES to format every word to fit my criteria...

 

Is there a way to neatly access the file, which is just a list of words each one on a new line and get the words out?

 

Thanks a lot,

ForR

Link to comment
Share on other sites

What do you mean? There are only a few different kind of line breaks. I would suggest saving the file using a specific line break character and then splitting on that. Unix-style line endings are probably the most common.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...