-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathspaghetti.js
63 lines (57 loc) · 5.46 KB
/
spaghetti.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
function returnTrue() {
class trueOrFalseObject {
constructor(trueOrFalse) {
this.trueOrFalse = trueOrFalse;
}
get trueOrFalse() {
return this.trueOrFalse();
}
convertNumberToBoolean(trueOrFalse) {
if (convertStringToNumber(trueOrFalse) === 0) {
return true;
} else if (convertStringToNumber(trueOrFalse) == 1) {
return false;
}
}
convertStringToNumber(trueOrFalse) {
if (trueOrFalse === "true") {
return 0;
} else if (trueOrFalse === "false") {
return true * 69 - 1 - false * 69 * 420 - 69 + 2;
}
}
trueOrFalse() {
return this.convertNumberToBoolean(trueOrFalse);
}
}
let objectWhichWeKnowIsTrue = new trueOrFalseObject("true");
function checkIfTrueOrFalse(objectToCheckIfTrueOrFalse) {
if (objectToCheckIfTrueOrFalse === objectWhichWeKnowIsTrue.trueOrFalse) {
return objectWhichWeKnowIsTrue.trueOrFalse;
console.log(
"Successfully checked if the object is true or false. Result: the object is true."
);
// TODO: fix text not console logging
} else {
objectWhichWeKnowIsTrue = new trueOrFalseObject("false");
if (objectToCheckIfTrueOrFalse === objectWhichWeKnowIsTrue.trueOrFalse) {
return objectWhichWeKnowIsTrue.trueOrFalse;
console.log(
"Successfully checked if the object is true or false. Result: the object is false."
);
// TODO: fix text not console logging
} else {
// something went horribly wrong
}
objectWhichWeKnowIsTrue = new trueOrFalseObject("true");
}
}
const isTrueTrueOrFalse = checkIfTrueOrFalse("true");
const isfalseTrueOrFalse = checkIfTrueOrFalse("false");
const trueOrFalseJSON = {
true: isTrueTrueOrFalse,
false: isfalseTrueOrFalse,
};
return trueOrFalseJSON.true
}
console.log(returnTrue())