at the bottom of body.\r\nOr put code in \r\nwindow.onload = function(){/*put here*/}\r\n\r\nand check how it works.","upvoteCount":3},{"@type":"Answer","text":"ok Works fine if i put the Script into the End of Body of html. is There a Way to seperate it into the js Part of coding? thank u for ur answer. ok Moment i will try the \"onload\"","upvoteCount":1}]} }
+ 1

[Solved] Trying to shuffle a word

I'm trying to shuffle a word but sometimes the word gets shuffled back to the original, why is that? https://code.sololearn.com/cMRW6QYkJWLX/?ref=app

1st Oct 2021, 6:44 PM
Tim
Tim - avatar
5 Answers
+ 2
Why not?
1st Oct 2021, 6:50 PM
JaScript
JaScript - avatar
+ 2
You can print your index and see what your algorithm do.
1st Oct 2021, 7:11 PM
JaScript
JaScript - avatar
+ 1
You are welcome.
1st Oct 2021, 7:37 PM
JaScript
JaScript - avatar
0
JaScript My apologies, I made it so the random index will never include the current index for each iteration until the index reaches 0, the letter that's not included will be swapped with the letter that's randomly chosen
1st Oct 2021, 6:54 PM
Tim
Tim - avatar
0
JaScript Will do, thanks for your response, have a good day.
1st Oct 2021, 7:12 PM
Tim
Tim - avatar