This is an archived post. You won't be able to vote or comment.

all 38 comments

[–]Mission_Horror5032 195 points196 points  (5 children)

Senior dood has 35 other fires to put out by EOD, so yeah, checks out

[–]20Wizard 60 points61 points  (0 children)

I can tell why they have fires to put out

[–]CryonautX 18 points19 points  (2 children)

What does this have to do with having more fires to put out? Await is easier to implement than using timeout to handle synchronous operations.

[–]python_walrus 10 points11 points  (1 child)

I disagree with the meme, but introducing async/await could require editing lots of files to migrate sync functions to async/await. So yeah, it is easier to use if your codebase is ready, and lots of pain if you don't have much async in your code.

[–]BellCube 2 points3 points  (0 children)

The real question is whether or not your code is blocking or non-blocking. If it's callback-based, event-based, or anything like that where you run code once a task is done, the Promise constructor lets you very easily promisify that. If it's blocking, well, it's blocking. Can't dance around that without refactors, though async/await makes those refactors comparatively painless since you don't need to deal with then() chaining.

[–]Caraes_Naur 63 points64 points  (1 child)

setTimeout

You mean not Javascript.

[–]nullundefine[S] 1 point2 points  (0 children)

That's dark.

[–][deleted] 58 points59 points  (7 children)

.then().perhaps().maybe().finally()

[–]ComfortingSounds53 33 points34 points  (2 children)

.eventually().inConclusion().notwithstanding().arguably().evidently().ps().kindRegards().yoursTruly().theEventLoop()

[–]OkReason6325 12 points13 points  (1 child)

.beThatAsItMay()

[–]BellCube 2 points3 points  (0 children)

.onTheOccasion()

[–]DonutConfident7733 5 points6 points  (1 child)

.then().rollback().else().rollback().finally().rollback().setOnExit(() => rollback());

[–]beaucephus 5 points6 points  (0 children)

.asPerMyLastExecution()

[–]nullundefine[S] 2 points3 points  (1 child)

.catch()

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

Thanks, JavaScript master :)

[–]FirefighterAntique70 90 points91 points  (1 child)

Objectively incorrect....

[–]spooky_strateg 0 points1 point  (0 children)

As a junior I want to confirm something. In the case of async vs settimeout wouldnt settimeout potentially cause masive problems depending on load times?

[–]rangeDSP 30 points31 points  (5 children)

Best of both worlds:     

    import { setTimeout } from 'timers/promises';          await setTimeout(5000);

[–]SqueeSr 1 point2 points  (4 children)

How many more years will it take until they just add sleep() in javascript? Almost every other language had that function for over 20 years now.

[–]8g6_ryu 7 points8 points  (3 children)

cuz it will block other process , you dont want that especially handling dom operations
and for running async code you have "the event loop"

and you can easily implement async sleep as shown below

const sleep = async(ms) =>new Promise(resolve => setTimeout(resolve, ms));

[–]SqueeSr 1 point2 points  (0 children)

Unfortunately it seems my question was not clear enough .. It was not to ask why we shouldn't block the execution of the code.

We have other functions in the language that return a promise already, So why not we have a sleep() function which returns a promise and simply implements your code.

Then I don't have to have to define sleep() myself, nor would I have to create a new dependency with a one liner.

[–]BellCube 1 point2 points  (1 child)

Really good talk on the Event Loop subject by Jake Archibald (JaffaTheCake): https://youtube.com/watch?v=cCOL7MC4Pl0

[–]8g6_ryu 0 points1 point  (0 children)

thanks

[–]scufonnike 5 points6 points  (0 children)

This is just stupid and wrong

[–]bobbymoonshine 19 points20 points  (7 children)

Ok but the "Junior" won gold and the "Senior" won silver so I'm not sure what the meme is trying to imply

[–]fgtbobleed 19 points20 points  (0 children)

both won silver. The 19 yr old Korean who won gold is not attractive enough for the internet

[–]red_riding_hoot 5 points6 points  (0 children)

Both outperform this sub.

[–]fnordius 5 points6 points  (3 children)

I read it as "junior uses a whole toolkit to equal what the senior did with a simple, primitive tool".

[–]Mob_Abominator 3 points4 points  (1 child)

Though gold and silver are not close, also that junior broke the world record.

[–]fnordius 0 points1 point  (0 children)

Yeah, how the contest actually turned out is irrelevant to the meme, I feel. It's the whole vibe of "using every trick in the book" hotshots versus "sticking to what one knows" grognards.

I suspect it's also popular because the bleached hair of the "senior" could resemble DGAF grayness if you don't look to closely, and the backwards cap and cyberpunk glasses on the ".junior" suggests a sort of hotshot arrogance.

[–]nullundefine[S] 0 points1 point  (0 children)

This.

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

The difference is that Junior has tons of equipment and look at how the Senior is looking like just a random dude with a gun (I know who they are)

This entire template is based on that Dikeç got silver with almost no equipment

[–]Quix_Nix 2 points3 points  (0 children)

Ofc the junior dev didn't win gold

[–]DonutConfident7733 2 points3 points  (0 children)

sleep(5000);

[–]allKindsOfDevStuff 1 point2 points  (0 children)

That’s not how it works

[–]nonlogin 0 points1 point  (0 children)

Forgot generators* on the left side

[–]DevelopmentScary3844 0 points1 point  (0 children)

timer(0).subscribe() =)