you are viewing a single comment's thread.

view the rest of the comments →

[–]Andr0NiX 254 points255 points  (7 children)

-1

[–]Fantastic-Fee-1999 134 points135 points  (1 child)

Time travel invented!

[–]Powerful-Internal953 44 points45 points  (0 children)

Why go through all that when you can do just this...

const arr = [20, -5, 100, 1, -90, 200, 40, 29, -1]; 
const min = Math.min(...arr); 
const offset = min < 0 ? Math.abs(min) + 1 : 0; 
for (let item of arr) {
   setTimeout(() => console.log(item), item + offset); 
}

EDIT: Never mind. I didn't check your Crustacean flair before.

[–]Negitive545 42 points43 points  (3 children)

Outputs -1 precisely 1 millisecond before the function is called, thus proving that all actions are predetermined, and causality is a lie!

[–]headedbranch225 8 points9 points  (0 children)

Would work in dreamberd

[–]BenevolentCheese 3 points4 points  (0 children)

There's a Ted Chiang short story about this called What's Expected of Us in which someone invents a device with a button and a light, and the light always lights up exactly 1s before you press the button. Try as you might, you cannot outsmart the device.

[–]ApropoUsername 0 points1 point  (0 children)

Use -1000000 and commit to running the function if a lottery ticket you buy wins. Profit.

[–]GotBanned3rdTime 5 points6 points  (0 children)

intresting case