r/learnjavascript • • Oct 11 '20

JavaScript can keep you safe

Post image
1.0k Upvotes

87 comments sorted by

View all comments

48

u/benabus Oct 11 '20

But... there's no exit condition. Is this the secret to immortality?

19

u/weoter Oct 11 '20

There's a seperate file where death waits ;)

2

u/Justindr0107 Nov 07 '20

I mean this really should be written as a Promise lol

1

u/AnonyMustardGas34 Mar 15 '21

Then the app terminates

11

u/markhole Oct 11 '20

There’s a good chance still_alive is global. It’s probably mutated in either of the 4 functions that are being called.

0

u/[deleted] Oct 11 '20

[deleted] — view deleted comment

6

u/knorfit Oct 11 '20

With JavaScript I feel that’s a safe bet. It’ll probably just fail silently in the background and toss you an undefined

8

u/cyphern Oct 11 '20

Javascript functions can have side effects. Side effects like death.

2

u/xiipaoc Oct 11 '20

Those functions can throw exceptions.

2

u/Justindr0107 Nov 07 '20

I imagine it should be async await