Task 2: The assignment to canvas.textContent is not needed. You can just call the function.
Task 3: You can replace name.length - name.length with 0 since this value is mathematically always zero.
If you like I have an additional question for task 3:
We want our random() function to have an excluding upper bound. For example random(3, 6) should return 3, 4 or 5.
What needs to be changed in random() to achieve this?
What needs to be changed in chooseName() so that the example still works?
I’m glad you enjoyed it. Sometimes, when a learner presents well solved tasks I’m afraid they are getting bored and I try to come up with something.
You’re new solution is correct. As you see, by redefining the meaning of the upper bound the code became simpler (function and its call). So the point to take away is: “Always think about the (coding) rules you impose on yourself. Can they be changed to make things easier?”
Most of the time it’s more like you’re making a function more complex, but its calls at different places in the code will become easier. It’s kind of a balancing thing.