+ 1
Random word
How do I create a random word in the middle of the sentence in JavaScript?
9 Respostas
+ 1
Can you show an example of what you are talking ?
You can use Math.Random() it returns 0 and 1 only
+ 1
Thank you! That was close what I wanted but I should have explained better. :D Is it possible to INSERT a random word into the middle of a non-random sentence?
+ 1
Yes, in the middle would be great! :))
0
I think you want to get a random word from a sentence right?
0
https://code.sololearn.com/WbVTRn4UE2y4/?ref=app
Yes, I was inspired by this. I can create whole random sentences with it but what if I want a random word in the middle of a non-random sentence? How would I do that?
0
Unrealistic Engineer Here is how you get a random word from a sentence :))
https://code.sololearn.com/WbkLND0LDb4o/?ref=app
Check the js tab :))
Use the getRandomWord function!
0
Unrealistic Engineer Now that makes total sense. Is it have to be in the exact middle or anywhere in a non-random sentence?
0
Unrealistic Engineer I think this is as expected. Is it after all?
https://code.sololearn.com/WbRuos352saj/?ref=app
0
Thank you! :) Yes, almost! But would it be possible to have an array of 7 words that get randomly inserted into the sentence?