Created
March 1, 2022 00:46
-
-
Save Blazing-Mike/e0676e9929ff20303abed27255a9ca2d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* For the first task, you have to create a simple function — chooseName() — that prints | |
a random name from the provided array (names) to the provided paragraph (para), and then run it once. */ | |
const names = ['Chris', 'Li Kang', 'Anne', 'Francesca', 'Mustafa', 'Tina', 'Bert', 'Jada'] | |
const para = document.createElement('p'); | |
function chooseName(){ | |
let eachName = names[Math.floor(Math.random() * names.length)]; | |
para.textContent = eachName; | |
} | |
chooseName(); | |
// Don't edit the code below here! | |
section.innerHTML = ' '; | |
section.appendChild(para); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment