-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathif.js
29 lines (21 loc) · 757 Bytes
/
if.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
/*
The objective of this is to play with if, if else, switch, and objects as switches.
This is all rather subjective. Although it would be interesting to see
if one of them provides a performance benefit given enough options.
So. I'll write the same program over and over.
The program will... generate a random number 100 times... then print out a message
for the different possibilities.
*/
const { Orange } = require("./components/Orange");
const { Papaya } = require("./components/Papaya");
const app = () => {
const display = "Orange";
if (display === "Orange") {
return new Orange().render();
} else if (display === "Papaya") {
return new Papaya().render();
} else {
return "Select an option.";
}
};
console.log(app());