1// JavaScript Test File
2
3// explain javascript to me
4
5// convert to fat arrow style
6function heavyComputation(a, b) {
7 const factor = 2.5;
8 let result = 0;
9
10 // Perform loop
11 for (let i = 0; i < 10; i++) {
12 if (i % 2 === 0) {
13 result += (a * b) * factor;
14 } else {
15 result -= i;
16 }
17 }
18
19 return result;
20}
21
22const user = {
23 name: "John Doe",
24 age: 30,
25 isActive: true
26};
27
28console.log("Starting computation...");
29var output = heavyComputation(10, 20);
30console.log(`Final Result: ${output}`);
31
32class Processor {
33 constructor(data) {
34 this.data = data;
35 }
36
37 process() {
38 return this.data.map(x => x * 2);
39 }
40}