DEV Community

Daniel Hansson
Daniel Hansson

Posted on

3 2

Sum 2 numbers, wrong answers only

Hey Dev.to!
It is almost Friday, so lets start the day with a fun task, sum two numbers together. But without summing the two numbers together like this, like you would do normally:

const num1 = 2;
const num2 = 3;
const result = num1 + num2;
console.log(result);
Enter fullscreen mode Exit fullscreen mode

I start with my solution:

const num1 = 2;
const num2 = 3;
const arr1 = new Array(num1).fill(0);
const arr2 = new Array(num2).fill(0);

const result = arr1.concat(arr2).length;
console.log(result);
Enter fullscreen mode Exit fullscreen mode

Will be fun to see what Frankenstein Solutions you folks come up with. ⚗️🧑‍💻

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay