Hi there,

I have attempted the exercises 1 & 2 of the following link with succesfull results.

However, after checking for other topics, I found the results provided, and they are different to the ones I have come up with. I´d like to know if my code is correct, and good practice. If not, I would like to understand why the provided results are better.

Thanks in advance.

**Code for Exercise 1;**

```
let names = ['Chris', 'Li Kang', 'Anne', 'Francesca', 'Mustafa', 'Tina', 'Bert', 'Jada']
let para = document.createElement('p');
function chooseName () {
para.innerHTML = names[Math.floor(Math.random() * names.length)];
};
const section = document.querySelector('section');
section.appendChild(para);
```

**Code for exercise 2**

```
let names = ['Chris', 'Li Kang', 'Anne', 'Francesca', 'Mustafa', 'Tina', 'Bert', 'Jada']
let para = document.createElement('p');
let canvas = document.querySelector('canvas');
let ctx = canvas.getContext('2d');
let x = 50;
let y = 60;
let width = 100;
let height = 75;
let color = 'blue';
function draw() {
ctx.clearRect(x,y,width,height);
ctx.beginPath();
ctx.fillStyle = color;
ctx.fillRect(x, y, width, height);
};
draw();
const section = document.querySelector('section');
```