-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
40 lines (37 loc) · 1.34 KB
/
main.js
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
// code for the mixed messages portfolio project
// Message object
const msg = {
_year: [],
ref: ["will certainly be your"," if well planned, will be your", "if nothing is done now will not be your",
"will be your", "seems to be your","will be your siter's","will be your son's",
"will be your daughter's","will be your Mama's","will be Dad's"],
wish: ["health & wellness","financial freedom","networking & relationships building",
"spiritual awareness & growth","relaxation & enjoyment","massive financial investment",
"harvesting the fruits of consistency","joy & laughter",
"spiritual regeneration"," sacrifice & service to humanity"],
set year(firstYear){
let arrYears = [];
for (i= 0; i<10; i++) {
arrYears.push(firstYear);
firstYear ++;
}
this._year = arrYears;
},
get year() {
return this._year;
}
};
//generate a random index
const indexGen = num =>{
let index = Math.floor(Math.random()*num);
return index;
}
//msg generation function
const printMixedMsg = (startYr) => {
msg.year = startYr;
let x = indexGen(msg.year.length);
let y = indexGen(msg.ref.length);
let z = indexGen(msg.wish.length);
console.log(`${msg.year[x]} ${msg.ref[y]} year of ${msg.wish[z]}`);
}
printMixedMsg(2021);