From 5a8dbc6347b3541e84fe669b22c17ad3b715e258 Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Wed, 21 Jan 2026 20:22:09 +0100 Subject: Engage! --- samples/test.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 samples/test.js (limited to 'samples/test.js') diff --git a/samples/test.js b/samples/test.js new file mode 100644 index 0000000..032b94d --- /dev/null +++ b/samples/test.js @@ -0,0 +1,40 @@ +// JavaScript Test File + +// explain javascript to me + +// convert to fat arrow style +function heavyComputation(a, b) { + const factor = 2.5; + let result = 0; + + // Perform loop + for (let i = 0; i < 10; i++) { + if (i % 2 === 0) { + result += (a * b) * factor; + } else { + result -= i; + } + } + + return result; +} + +const user = { + name: "John Doe", + age: 30, + isActive: true +}; + +console.log("Starting computation..."); +var output = heavyComputation(10, 20); +console.log(`Final Result: ${output}`); + +class Processor { + constructor(data) { + this.data = data; + } + + process() { + return this.data.map(x => x * 2); + } +} -- cgit v1.2.3