-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
43 lines (37 loc) · 1.33 KB
/
Copy pathscript.js
File metadata and controls
43 lines (37 loc) · 1.33 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
31
32
33
34
35
36
37
38
39
40
41
42
43
// Elements of change
const changes = [
"someone who shares the same goals as you",
"an old friend",
"someone who will open a hidden path for you",
"an old flame",
"someone from your past"
];
// A list of happenings
const happenings = [
"They will bring you surprising news.",
"They will unlock a new opportunity.",
"They will show you a path that will test your patience.",
"They will bring about huge change in your life.",
"They will cause huge disruption in your life."
];
// Pearls of wisdom to close
const pearls = [
"Trust your instics.",
"Move forward with caution.",
"The answers are clear to those who look hard enough.",
"I see that your your favourite colour will become a guide for you.",
"I see your lucky number bearing fruit."
];
// Function to pick random index of each array
function getRandomItem(array) {
return array[Math.floor(Math.random() * array.length)];
};
// Function to combine 3 elements of change, a happening and a pearl to create the Fortune.
function generateFortune() {
const change = getRandomItem(changes);
const happening = getRandomItem(happenings);
const pearl = getRandomItem(pearls);
return `Greetings traveller. I see a meeting ${change}. ${happening} ${pearl}`;
};
// Pring the fortune
console.log(generateFortune());