+ 1
Experimenting with JS return statement... help [SOLVED]
Is return only used for operations? +, -, /, * Or can you use it for other things too, like what Iām attempting in my code below? Itās very clear what Iām trying to do in the following code. YOUR LIST TO BE RANDOMIZED[Math.floor...] https://code.sololearn.com/WN3noR44IKMV/?ref=app
2 Answers
+ 3
You can put anything in the return statement. The problem is that on line 18, you are multiplying a number by an array
Math.floor(Math.random()*list)
Here, Math.random() returns a number which you are multiplying with list, an array. Replace `list` with `list.length` and your code should work fine
+ 2
XXX OMG. what am i thinking.?
I donāt know how did I forgot about that. I guess I just needed someone to remind ne.
Thank.You()