DEV Community

Daniel Hansson
Daniel Hansson

Posted on

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)