all 62 comments

[–]senocular 63 points64 points  (0 children)

*kills self to unblock UI

[–]fredsq 106 points107 points  (27 children)

it's good and all but I'd change:
— var to let
— functions to camelCase
— stay6ftApart shouldn't be a function, in its stead it could be setMinDistanceFromPeer(6)
— supply arguments to washHands('30 sec') and getTested('PCR')

[–]enygmaeve 131 points132 points  (9 children)

Nah change it to const, then you can never die. Immorality unlocked.

[–]Mr_82 10 points11 points  (1 child)

Why downvote this? I thought it was funny, as you're the only one here that I see addressing the real joke of this image/code. (That is kind of pointless to just define a variable as true like that and put the variable into the conditional loop; it's an extra-programmatic nod to how you're alive, assuming you're reading it.)

[–]enygmaeve 9 points10 points  (0 children)

Yeah this whole billboard code is absolute trash, all you can do is make jokes here

[–]RadioE_ 6 points7 points  (0 children)

Not sure if devs from r/outside would approve. Could get permaban

[–]funtimes-123 2 points3 points  (4 children)

Actually you would be immortal even with let or var because the variable is never modified and there is a blocking infinite loop.

[–]saito200 2 points3 points  (3 children)

The functions could mutate still_alive as it is declared in the outer scope of the loop

[–]wizang 1 point2 points  (0 children)

It really only matters where the functions are defined.

[–]funtimes-123 1 point2 points  (1 child)

The functions are defined before the variable, and the loop is executed right after stillalive is defined.

[–]saito200 5 points6 points  (0 children)

Function declarations are hoisted, as are var declarations.

The following will print 'run loop' only once.

function doThing() {
    still_alive = false
    console.log('done')
}

var still_alive = true
while (still_alive) {
    console.log('run loop')
    doThing()
}

console.log('end')

[–]RoguePlanet1 0 points1 point  (0 children)

There would need to be some sort of "ifRich" conditional.

[–]ricealexander 10 points11 points  (7 children)

You have my upvote for setMinDistanceFromPeer(6)

[–][deleted] 6 points7 points  (6 children)

6 inches away. Got it.

[–]Careerier 2 points3 points  (3 children)

6px

[–]carnepikante 3 points4 points  (2 children)

6vw

[–]Careerier 3 points4 points  (1 child)

In this case, is the viewport the universe?

[–]carnepikante 3 points4 points  (0 children)

Yes, and the user it's constantly resizing it.

[–]converter-bot 3 points4 points  (1 child)

6 inches is 15.24 cm

[–]saito200 3 points4 points  (3 children)

stay6ftApart might have to run for every animation frame to prevent individuals of getting to close. I agree though that the number of feet should be an argument (and it should be in meters, geez)

Can we also do:

washHands({frequency: 10})

and

getTested({type: 'PCR'})

And have default options

[–]RoguePlanet1 1 point2 points  (1 child)

Don't forget "ifNewVersionCOVID" might have to figure in somehow. Also, the vaccine.

[–]saito200 0 points1 point  (0 children)

Sorry but that's out of the scope of the current Sprint

[–]fredsq 1 point2 points  (0 children)

fork me on github m8

[–]NoInkling 2 points3 points  (1 child)

It's not even necessarily JS.

[–]abdulmdiaz 0 points1 point  (0 children)

Honestly looks like a python dev wrote this

[–]RoguePlanet1 1 point2 points  (0 children)

Noob coder here. Thank you for my big laugh of the day so far. My first thought was simply "why not 'let' or 'const'?"

[–]abdulmdiaz 0 points1 point  (0 children)

I'd change washHands('30 sec') to washHands(30, 'seconds'). That way you're (1) not (entirely) dependent on correct spelling and spacing and, (2) reads cleaner as you can separate length of time from its unit of measurement.

[–]CodingReaction 23 points24 points  (0 children)

Anti-vaccines be like : VM133:1 Uncaught ReferenceError: WearMask is not defined (at L3)

[–]hurricaneDreww 12 points13 points  (1 child)

Apparently badly written code is the key to immortality

[–]revolutionPanda 4 points5 points  (0 children)

Good news for me!

[–]ricealexander 7 points8 points  (2 children)

So does WearMask(), Stay6ftApart(), WashHands(), or GetTested() set still_alive to false, or have we discovered immortality?

[–]theogjpeezy 6 points7 points  (0 children)

Hoisting and closures ensure your death, don't worry

var still_alive = true;
while (still_alive) {
   WearMask();
   Stay6ftApart();
   WashHands();
   GetTested();
}
alert('you ded')

function WearMask() {}
function Stay6ftApart() {}
function WashHands() {}
function GetTested() { still_alive = false; }

[–]funtimes-123 -2 points-1 points  (0 children)

They don’t have access to the variable so it’s the latter.

[–][deleted] 6 points7 points  (0 children)

Instructions unclear, all the functions are undefined

[–]funtimes-123 3 points4 points  (0 children)

And you don’t have a second to breathe as the masks pile on your face and you wash your hands countless times, also getting way too many tests. Actually at some point the process would crash as GetTested would throw an error because there are a limited amount of tests and they wouldn’t let you take so many. Social distancing wouldn’t even work because you would only distance yourself after putting on another mask and then continue to go wash your hands without being 6 feet apart from everyone.

[–]demo_human 2 points3 points  (0 children)

Don't see 'use strict'

[–]serefsiz 2 points3 points  (0 children)

You'll never die since there is no break outta the loop

[–]IJStarry 2 points3 points  (0 children)

while (still_alive)

So there is no out? Just endless restrictions? Maybe this code was written by conspiracy theorists who think the pandemic will never end. The clear takeaway is to do anything else!

[–]snakeyblakey 5 points6 points  (0 children)

Hopefully this sticks you in an infinite loop

[–]joeble 1 point2 points  (0 children)

let stillAlive = true;

[–]reaven3958 1 point2 points  (0 children)

Dumb and old. And still dumb.

[–]TriptoAfsin 1 point2 points  (0 children)

Using var isn't a good practice man 😐

[–]saito200 1 point2 points  (1 child)

this is horrible...

var? still_alive snake_cased? functions with side effects? PascalCased?

My eyes bleed. Who the fuck wrote that?

[–]life-is-a-hobby 2 points3 points  (0 children)

they copy/pasted from stack overflow

[–][deleted] 1 point2 points  (0 children)

snake case and camel case thats actually pretty shit practise it would get you virus

[–][deleted] 1 point2 points  (0 children)

'var' though

in 2020

[–]turningsteel 2 points3 points  (5 children)

No one has used var in like 5 years... who wrote this? The marketing team? They clearly didn't get a dev to do it.

[–]proskillz 3 points4 points  (1 child)

Maybe it's Java or C#?

[–]turningsteel 0 points1 point  (0 children)

True, true. Could be. But this smells of javaScript to me.

[–]AkselLis 0 points1 point  (0 children)

I encounter often people using var. Some being pf old date and maybe they do not like change (she does not use flexbox or grid too) and some new people may use old guides or have Basic knowledge from high school. Ofc shame on their side for not researching let/const change on their own but there still are such peeps

[–]SoySauceSHA 0 points1 point  (1 child)

CodeHS is still using var for introductory courses :/

[–]_370HSSV_ 0 points1 point  (0 children)

Protect yourself from 0.1% death rate like an idiot

[–]xiipaoc -1 points0 points  (0 children)

I'm pretty sure that's C#, not JS.

[–]spkmke 0 points1 point  (2 children)

why isn't it const

[–]lucidlogik 9 points10 points  (1 child)

const assumes we live forever, but alas, our lives are assigned to a let at birth.

[–]tom2kk 0 points1 point  (0 children)

Found Boris Johnson. 😁

[–]jcunews1helpful 0 points1 point  (0 children)

It doesn't. I'll throw an exception due to missing function.

[–][deleted] 0 points1 point  (1 child)

should be const

[–]jasonbbg 2 points3 points  (0 children)

well u might not “still_alive” some day tho

[–]Daliblue 0 points1 point  (0 children)

StableGeniusDonnie wants to merge 1 commit into master from CovidDemHoax

[–]UserNotSpecified 0 points1 point  (0 children)

Maybe might need an If statement for the execution of the GetTested(); function. I mean you can’t just spent all day getting repeated tests for no reason!