<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Functions: Task 1</title>
<link rel="stylesheet" href="../styles.css" />
</head>
<body>
<section class="preview">
</section>
</body>
</html>
p {
color: purple;
margin: 0.5em 0;
}
* {
box-sizing: border-box;
}
const names = ['Chris', 'Li Kang', 'Anne', 'Francesca', 'Mustafa', 'Tina', 'Bert', 'Jada']
const para = document.createElement('p');
// Add your code here
function chooseName() {
para.textContent = names[Math.floor(Math.random()*names.length)];
// Had to research how to pick a random array item.
}
chooseName();
// Don't edit the code below here!
const section = document.querySelector('section');
section.appendChild(para);
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.