-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
30 lines (29 loc) · 1.11 KB
/
script.js
File metadata and controls
30 lines (29 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const Quotesarr = [
{
personname: 'Oscar Wilde',
quotes: 'Be yourself; everyone else is already taken.',
},
{
personname: 'Marilyn Monroe',
quotes:
"I'm selfish, impatient and a little insecure. I make mistakes, I am out of control and at times hard to handle. But if you can't handle me at my worst, then you sure as hell don't deserve me at my best.",
},
{
personname: 'Albert Einstein',
quotes:
"Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.",
},
{
personname: 'Marcus Tullius Cicero',
quotes: 'A room without books is like a body without a soul.',
},
]
let btn = document.querySelector('#btn')
let container = document.querySelector('.quotes-box-container')
let authorquotes = document.querySelector('#quotes-text')
let authorname = document.querySelector('#author-name')
btn.addEventListener('click', () => {
let number = Math.abs(Math.ceil(Math.random() * Quotesarr.length - 1))
authorname.textContent = Quotesarr[number].personname
authorquotes.textContent = Quotesarr[number].quotes
})