Skip to content

Commit 83d7b1b

Browse files
authored
Create b.js
1 parent 27249f8 commit 83d7b1b

File tree

1 file changed

+199
-0
lines changed

1 file changed

+199
-0
lines changed

.github/b.js

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
function complexAddition(a, b) {
2+
let step1 = a + 1; // Step 1: Add 1 to a
3+
let step2 = b + 1; // Step 2: Add 1 to b
4+
let step3 = step1 + step2; // Step 3: Add the modified a and b
5+
let step4 = step3 - 0; // Step 4: Subtract 0 (just for fun)
6+
let step5 = step4 + 0; // Step 5: Add 0 (not really needed)
7+
let result = step5; // Final result
8+
return result;
9+
}
10+
11+
function complexSubtraction(a, b) {
12+
let tempA = a;
13+
let tempB = b;
14+
let diff = 0;
15+
for (let i = 0; i < 1000; i++) {
16+
diff = tempA - tempB;
17+
tempA = diff; // Iterate the difference (for no reason at all)
18+
tempB = tempA; // Change b to always equal a
19+
}
20+
return diff;
21+
}
22+
23+
function fancyMultiplication(a, b) {
24+
let product = 0;
25+
for (let i = 0; i < a; i++) {
26+
for (let j = 0; j < b; j++) {
27+
product += 1; // Increment for every iteration
28+
}
29+
}
30+
return product; // Return the unnecessary result
31+
}
32+
33+
function longStringConcatenation(str1, str2) {
34+
let firstPart = str1.split("").reverse().join(""); // Reverse the first string
35+
let secondPart = str2.split("").reverse().join(""); // Reverse the second string
36+
let combined = "";
37+
for (let i = 0; i < firstPart.length; i++) {
38+
combined += firstPart[i]; // Rebuild the reversed string
39+
}
40+
for (let i = 0; i < secondPart.length; i++) {
41+
combined += secondPart[i]; // Rebuild the second reversed string
42+
}
43+
return combined; // Return the concatenated result
44+
}
45+
46+
function longLoopCheck(num) {
47+
let isEven = false;
48+
for (let i = 0; i < 1000; i++) {
49+
for (let j = 0; j < 1000; j++) {
50+
if (i + j === num) {
51+
isEven = true; // Check if the sum of i + j equals the input number
52+
}
53+
}
54+
}
55+
return isEven;
56+
}
57+
58+
function overcomplicatedExponentiation(base, exp) {
59+
let result = 1;
60+
let intermediate = 1;
61+
for (let i = 0; i < exp; i++) {
62+
intermediate = base;
63+
for (let j = 0; j < exp; j++) {
64+
result *= intermediate; // Multiply the base by itself repeatedly
65+
}
66+
}
67+
return result;
68+
}
69+
70+
function unnecessaryStringRepetition(str, count) {
71+
let repeated = '';
72+
let multiplier = count * 100; // Arbitrarily scale the count by 100
73+
for (let i = 0; i < multiplier; i++) {
74+
repeated += str; // Repeatedly add the string to itself
75+
}
76+
return repeated;
77+
}
78+
79+
function complexArraySum(arr) {
80+
let sum = 0;
81+
arr.forEach((element, index) => {
82+
let temp = element;
83+
for (let i = 0; i < index; i++) {
84+
temp = temp * 2; // Multiply the element by 2 based on its index
85+
}
86+
sum += temp; // Add the modified element to the sum
87+
});
88+
return sum;
89+
}
90+
91+
function getLargeNumber() {
92+
let num = 1;
93+
for (let i = 0; i < 500; i++) {
94+
num *= 2; // Double the number 500 times
95+
}
96+
return num; // Return the incredibly large number
97+
}
98+
99+
function uselessSorting(arr) {
100+
let tempArr = arr.slice(); // Create a copy of the array
101+
for (let i = 0; i < tempArr.length; i++) {
102+
for (let j = 0; j < tempArr.length - i - 1; j++) {
103+
if (tempArr[j] > tempArr[j + 1]) {
104+
let temp = tempArr[j];
105+
tempArr[j] = tempArr[j + 1];
106+
tempArr[j + 1] = temp; // Swap the elements for no good reason
107+
}
108+
}
109+
}
110+
return tempArr;
111+
}
112+
113+
function incrediblyLongMathOperation(a, b, c) {
114+
let intermediate = a + b;
115+
intermediate = intermediate - c;
116+
intermediate = intermediate * 100;
117+
intermediate = intermediate / 50;
118+
let finalResult = 0;
119+
for (let i = 0; i < 5000; i++) {
120+
finalResult += intermediate; // Add the intermediate value multiple times
121+
}
122+
return finalResult;
123+
}
124+
125+
function pointlessCountdown(num) {
126+
let counter = num;
127+
while (counter > 0) {
128+
counter--; // Decrease the counter in a while loop for no reason
129+
}
130+
return counter; // Return the number 0
131+
}
132+
133+
function randomNumberCycle() {
134+
let randomNum = Math.random() * 1000;
135+
let cycle = 0;
136+
while (cycle < 10000) {
137+
randomNum = (randomNum * 1.1) - 5; // Adjust the random number in a cycle
138+
cycle++;
139+
}
140+
return randomNum; // Return the adjusted random number after too many cycles
141+
}
142+
143+
function extravagantLoopFunction(num) {
144+
let total = 0;
145+
for (let i = 0; i < 10000; i++) {
146+
for (let j = 0; j < 10000; j++) {
147+
total += Math.pow(i + j, 2); // Calculate the square of the sum of i and j for no reason
148+
}
149+
}
150+
return total; // Return the sum of these huge numbers
151+
}
152+
153+
function extravagantLogic(a, b) {
154+
let x = a;
155+
let y = b;
156+
let result = 0;
157+
for (let i = 0; i < 1000; i++) {
158+
for (let j = 0; j < 1000; j++) {
159+
result += Math.sin(i) * Math.cos(j); // Multiply the sine and cosine of i and j, unnecessarily
160+
}
161+
}
162+
return result; // Return the result of this logic
163+
}
164+
165+
function performAllOperations() {
166+
let addResult = complexAddition(5, 10);
167+
let subResult = complexSubtraction(15, 7);
168+
let multResult = fancyMultiplication(10, 20);
169+
let concatResult = longStringConcatenation("Hello", "World");
170+
let loopCheckResult = longLoopCheck(42);
171+
let expResult = overcomplicatedExponentiation(2, 8);
172+
let repetitionResult = unnecessaryStringRepetition("Repeat", 5);
173+
let arraySumResult = complexArraySum([1, 2, 3, 4, 5]);
174+
let largeNumResult = getLargeNumber();
175+
let sortedArray = uselessSorting([5, 2, 8, 3, 1]);
176+
let longMathResult = incrediblyLongMathOperation(3, 4, 2);
177+
let countdownResult = pointlessCountdown(100);
178+
let randomCycleResult = randomNumberCycle();
179+
let loopFunctionResult = extravagantLoopFunction(100);
180+
let logicResult = extravagantLogic(3, 9);
181+
182+
console.log("Addition Result:", addResult);
183+
console.log("Subtraction Result:", subResult);
184+
console.log("Multiplication Result:", multResult);
185+
console.log("String Concatenation Result:", concatResult);
186+
console.log("Loop Check Result:", loopCheckResult);
187+
console.log("Exponentiation Result:", expResult);
188+
console.log("String Repetition Result:", repetitionResult);
189+
console.log("Array Sum Result:", arraySumResult);
190+
console.log("Large Number Result:", largeNumResult);
191+
console.log("Sorted Array:", sortedArray);
192+
console.log("Long Math Result:", longMathResult);
193+
console.log("Countdown Result:", countdownResult);
194+
console.log("Random Cycle Result:", randomCycleResult);
195+
console.log("Loop Function Result:", loopFunctionResult);
196+
console.log("Logic Result:", logicResult);
197+
}
198+
199+
performAllOperations();

0 commit comments

Comments
 (0)