Assessment wanted for Functions 1 skill test

Hi, I’m pretty sure I’ve done this right, but could I please get an assessment?
Thanks in advance!

Hi there @ImpaktDigital!

You have got this pretty much right, but consider this — sometimes when you run it, you get no result. This is because when the random number returned is less than one, Math.floor() will round it down to 0, and then the -1 means that random number returned is -1, and it returns nothing because array index -1 doesn’t exist.

So in this case, you actually need nameLen, not nameLen - 1.

You can see our solution for this here.

Well done on a really good attempt!