Assessment wanted for -> functions

Here’s the assessment, my code and a live example.

Any advice is always welcome. :smiley:

Hi @salvadorperezm

Great work on this exercises! :medal_sports:

Here are some comments:

  • Task 1: What’s the reasoning behind + 0?
  • Task 2: You could combine rect() and fill() to ctx.fillRect(x, y, width, height);
  • Task 3: Your random() function only works when min is 0. For example, when you choose min=3 and max=8 than you will get a number between 3 and 10. The correct formula would be: Math.floor(Math.random() * (max - min)) + min
  • Task 4: No comments here. Perfectly solved :smiley:

Keep up the good work!

Happy coding,
Michael

2 Likes

My response to your comments:

  • Task 1: It was a mistake, I was working on the third task first so that’s why there’s a + 0 on there. It was supposed to be a + min.

  • Task 2: Thanks, I’d never worked with canvas before so this was the toughest task for me.

  • Task 3: I’ll be updating my formula as soon as possible.

Thank your for your comments @mikoMK, I’ll be updating my code as soon as possible. :smiley:

2 Likes

Now everything is perfect :smiley:
Great work!

1 Like