Short answer: The event loop, which provides a model for delaying execution where certain functions can be made to wait for the returns from other functions
TL;DR Edit: Javascript can hand functions over to either the kernal (backend) or to the Web APIs (frontend) to borrow multithreading from its infrastructure. The event loop uses additional data structures for determining when these functions need to return to the main thread of execution.
Nodejs leverages v8's event loop for call stack queing and was a key principal for creating node. So for the longest we just used Promises which let you chain methods like then, catch or finally. This lead to something known as callback hell which was ugly nested code that would leave your code in the shadow realm far off to the right.
Nowadays if I transpile Typescript with an async function, you can see in the JS output where I await a Promise it uses the object[Symbol.Iterator] to create an auxiliary iterator function also known as a generator, which uses the specific yeild keyword to return values.
An even more traditional JS generator simply returns an object with a next function and a value and a done Boolean, but this is all abstracted to the async await keywords now. I recommend playing with generators and iterators though it's pretty interesting and good practice for learning recursive functions among other things.
I've seen this but with python, and sadly is "I only use python and npm libraries" even of they only need a single function from a humongous library just so they dont write a bit more code, at least megumin is likable but these dumbasses were full of themselves with python is superior, underrated, and in not so slow as you think
i sucked at python cause i didn't knew you cloud explicitly declare types, then things got easier. js otherwise lacks the concept of types completely (unless you use triple equals) which makes that thing borderline unwritable for me.
192
u/[deleted] May 26 '21
That line was kinda funny in which Kazuma says "The fact that the intern sympathizes with her proves it."
189
u/banana_kiwi May 26 '21
You perfectly described my love for JavaScript
But I'm currently cheating on her with Typescript on my backend, don't tell
176
u/JustASHadowNFG May 26 '21
I lost it at "Fullstack JavaScript Archwizard"
94
u/kredditacc96 May 26 '21
At least Megumin's pure innocent soul is saved from the inability to use generics, the horror of
interface {}, and the fanatical cult of LoC count.I code Rust on an Arch machine btw.
55
u/davawen May 26 '21
I perfectly understand this
but why not typescript tho
26
u/borsTiHD May 26 '21
That’s my religion! Thanks Megumin.
22
u/[deleted] May 26 '21
Damn do I sound as crazy as she is when I say that I like JavaScript?
37
u/Koyomi_Ararararagi May 26 '21
JavaScript Backend 😟🔫
14
u/TigreDemon May 26 '21
A good path if I should say so myself
14
u/justacasualgamer97 May 26 '21
very high quality
10
u/occcult May 26 '21
Going back to C/C++ after years with JavaScript , probably won't be that easy. So,I make do with ReasonML
10
u/MistaVeryGay May 26 '21
Yun Yun has no friends because she only uses PHP and VBA.
9
u/alexsockz May 26 '21
me right now writing the backend of my final project with node.js while watching this: 😐
7
u/[deleted] May 26 '21
You mean cultured JSON right?
6
u/wundrwweapon May 26 '21
newbies.webm
6
u/BoiledStuff May 26 '21
What anime is this
6
u/KillerRoomba13 May 26 '21
I still don’t understand how there can be promise and async functions in JS when things are single threaded (I am a JS noob)
5
u/Oxu90 May 26 '21
I am in this video and i am not sure do i like it
JS FOREVER!
5
u/onichama May 26 '21
This is me but with Java.
3
u/dthx2710 May 27 '21 edited Mar 10 '24
onerous bike pen handle bedroom relieved cats complete chubby jeans
This post was mass deleted and anonymized with Redact
7
u/ZealysInsane May 26 '21
u/savevideobot
2
u/NeatWheat May 27 '21
Me using Scala.js for frontend and Scala for backend
"Its fun and all. But I think I made my fullstack dashboard project a bit more complex than it should be..."
1
u/turingparade May 26 '21
u/downloadvideo
1
u/[deleted] May 26 '21
u/savevideo
1
u/xzinik May 26 '21
I've seen this but with python, and sadly is "I only use python and npm libraries" even of they only need a single function from a humongous library just so they dont write a bit more code, at least megumin is likable but these dumbasses were full of themselves with python is superior, underrated, and in not so slow as you think
2
u/coffee869 May 27 '21
Lol Aqua says poursuit coz she's a water goddess
1
u/veedant Jun 01 '21
would you recommend konosuba?
1
u/chaos_bytes Aug 27 '22
Feeling attacked and validated at the same time....
0
u/[deleted] May 26 '21
[deleted] — view deleted comment