forked from bakoliasn/basic-javascript-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfortune.js
More file actions
21 lines (19 loc) · 1.05 KB
/
Copy pathfortune.js
File metadata and controls
21 lines (19 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*The Fortune Teller
------------------------------------------
Challenge: create a file called fortune.js in your Cloud9 project. Running this file should output a random quote from a list of 10 different quotes.*/
function randomQuote(randNum) {
var quotes = [
"Happiness is a method of life, not a destination",
"Dont't cry because it's over, smile because it happened",
"Be yourself, everyone else is already taken",
"You only live once, but if you do it right, once is enough",
"Insanity is doing the same thing, over and over again, but expecting different results",
"Life is what happens to you while you're busy making other plans",
"I have not failed. I've just found 10,000 ways that won't work",
"I solemnly swear that I am up to no good",
"For every minute you are angry you lose sixty seconds of happiness",
"If you can't explain it to a six year old, you don't understand it yourself"
];
return quotes[randNum];
}
console.log(randomQuote(Math.floor(Math.random() * 10)));