I used one file for all of my Functions Assessments, they’re just commented out. Pardon any confusion. I just want to be efficient with the space.
I noticed that para.textContent = shortNames; outputs Anne,Tina,Bert,Jada. I’ve been trying to figure out how to add a space between the commas so the output is Anne, Tina, Bert, Jada.
What’s the best way to do this? I tried some different methods but no luck.
Well done!
Here are my comments:
Task 1: Correct.
Task 2: Mostly correct. You don’t need ctx.fill();. The previous line already creates and fills the rectangle. Also I would generally clear the canvas before starting to paint: ctx.clearRect(0, 0, canvas.width, canvas.height);. (No difference in this particular exercise)
Task 3: Correct.
Task 4: Correct.
Instead of the implicit toString() method you could use join() where you are able to define a separator: para.textContent = shortNames.join(', ');