Arindam Paul - JavaScript VM internals, EventLoop, Async and ScopeChains

Поделиться
HTML-код
  • Опубликовано: 11 июл 2024
  • This talk provides:
    1. A crisp understanding of the JavaScript VM and how a single threaded engine can be massively parallel.
    2. How event loop and callbacks works, example of blocking and non-blocking codes, ES6 generators for custom Async signaling.
    3. How function definitions happen and invocations happen, how scope chains are formed, what closures are and how to reason about them.
    4. Async programming, how reactive programming works at the bottom level, how event listeners registers themselves and then deregisters.
    Summary and discussion: hasgeek.com/jsfoo/2015/schedu...
  • НаукаНаука

Комментарии • 135

  • @HasGeekTV
    @HasGeekTV  3 года назад +3

    Hasgeek launched in 2010. It’s been a decade! Join us for a recap of the year.
    If Hasgeek made an impact on your personal/professional journey, share your testimonial on: hasgeek.com/hasgeek/10/

  • @raccoon0413
    @raccoon0413 6 месяцев назад +1

    I always come back to this video, concreting my understanding on how JS works behind the scene.

  • @suryaprakash124
    @suryaprakash124 7 лет назад +2

    Really awesome explanation. The way i look at javascript is completely changed. Thank you so much.

  • @laurental
    @laurental 8 лет назад +7

    It starts slowly, but the run through at the tenth minute is very good, thhanks a lot

  • @linaskid
    @linaskid 8 лет назад +30

    This is awesome. Lot of things in jS now makes sense.

  • @inframatic
    @inframatic 7 лет назад +2

    Awesome tutorial, very easy to understand the way you describe it

  • @mado023
    @mado023 7 лет назад +6

    This was super !! got the actual idea of closure

  • @giteshkhanna2633
    @giteshkhanna2633 4 года назад

    I just started with Javascript. Great presentation!

  • @mehmetyeneryilmaz3367
    @mehmetyeneryilmaz3367 3 года назад +2

    This is more than just a presentation.. thanks!

  • @chinmoydebnath7355
    @chinmoydebnath7355 4 года назад +1

    This is awesome. Thank you for this great talk.

  • @ShawYew
    @ShawYew 3 года назад

    Excellent talk, really explains event Q and why setTimeout should be used with caution.

  • @ksvignettee
    @ksvignettee 7 лет назад

    Awesome one bud. Thanks for sharing this one!

  • @Muaddibkhan
    @Muaddibkhan 3 года назад +2

    Got your point : programming is about abstractions but to understand those abstractions one must know the internals. Or as he says it you become chess master once you know the internals 👍 great talk

  • @vaibhavsehgal6479
    @vaibhavsehgal6479 3 года назад

    Excellent talk! Very well explained!

  • @RadinReth
    @RadinReth 7 лет назад +3

    what a great presentation!

  • @pradeeplakshminarasimha8332
    @pradeeplakshminarasimha8332 5 лет назад +1

    Best explanation of JS ever!

  • @baurks
    @baurks 6 лет назад

    Great information and presentation! Thank you!

  • @rajugangadhar232
    @rajugangadhar232 6 лет назад

    I had a really hard time understanding the difference between function scope and closure. I can even understand the formal definition of closure. :D Thanks a lot for this video.

  • @dappinstitute
    @dappinstitute Год назад

    Amazing talk. Any more like this? Fantastic.

  • @sunformoon27
    @sunformoon27 7 лет назад +1

    Simply nailed it. Awesome.

  • @vinothkumarv9722
    @vinothkumarv9722 3 года назад

    I can understand before coming this video some other mentor are explained clear to me
    But this is also. Awesome bro ❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️
    I love more on JavaScript

  • @akhanda-
    @akhanda- 8 лет назад +2

    awesome just inspired me to dig in more...

  • @143balug
    @143balug 7 лет назад +9

    This is awesome.

  • @jaypatel9485
    @jaypatel9485 4 года назад

    Great. Absolute clarity.

  • @gentlerainsky
    @gentlerainsky 8 лет назад +8

    This video is so good!!! I learn a lot of things.

  • @umeshnaik1235
    @umeshnaik1235 5 лет назад +1

    The explanation is very good 👍

  • @frankk6416
    @frankk6416 4 года назад

    Excellent talk, thanks!

  • @shafeeqmuhammed6602
    @shafeeqmuhammed6602 7 лет назад

    fabulous job... expecting more videos...

  • @muralidhardasari9186
    @muralidhardasari9186 7 лет назад

    Very useful information, Thank you.

  • @diegofss11
    @diegofss11 4 года назад

    Amazing video. Thanks

  • @10renganatha
    @10renganatha 7 лет назад

    Awesome Presentation

  • @hanyoong7640
    @hanyoong7640 2 года назад

    GDI, this is so useful. No reason to hate javascript once this makes sense!

  • @PranayGargSecure
    @PranayGargSecure 2 года назад

    Great talk.

  • @ravikant.chaudhary
    @ravikant.chaudhary 7 лет назад

    Well explained. Things in JavaScript are bit more clear now.

  • @appliedcomputerprogramming5206
    @appliedcomputerprogramming5206 4 года назад

    Simply brilliant

  • @rbiswas01
    @rbiswas01 8 лет назад +1

    Good one Arindam.

  • @appliedcomputerprogramming5206
    @appliedcomputerprogramming5206 4 года назад

    Great talk. Is there a possible" oral typo" myG can't be set equal to g() outside f(z) scope did you mean as is written myG= f(1)??

  • @mo_i_nas
    @mo_i_nas 2 года назад

    Amazing information

  • @BipinOli90
    @BipinOli90 5 лет назад

    amazing talk

  • @GirishVenkatachalam
    @GirishVenkatachalam 6 лет назад

    Very nice understood a lot today

  • @MichaelM1800
    @MichaelM1800 5 лет назад

    Quite informative!

  • @ajaypremshankar
    @ajaypremshankar 7 лет назад +1

    Thank for the video :)

  • @RAMPAVAN90
    @RAMPAVAN90 7 лет назад +14

    Hey guys I though this information would help you.
    During the memory allocation phase,if you have a variable assignment (var b =3) it will allocate the memory for variable b and set the value of be to be UNDEFINED,a special value in JS.And later during execution phase the assignment actually happens.

    • @kalyaninutopia
      @kalyaninutopia 7 лет назад +1

      There is a misnomer for that, it's called hoisting and it happens only for var, let and const declarations and function declarations, not for expressions. Go through ECMAScript spec, HTML spec, CSS spec and finally open documentations of V8 or Chakra engine, you will find all information there.

    • @JurajPecháč
      @JurajPecháč 6 лет назад

      In ECMAScript 2015, let bindings are not subject to Variable Hoisting, which means that let declarations do not move to the top of the current execution context.

    • @sebastiankumlin9542
      @sebastiankumlin9542 6 лет назад +1

      As far as I know , of "var", "let" and "const" only the variable declaration "var" ( not "let" and "const") is hoisted. This means variable initialization is not hoisted.

    • @harshityadav1248
      @harshityadav1248 Год назад

      @@sebastiankumlin9542 Absolutely correct. Hosiiting is for var and function declaration, not even for let, const, and function expressions. Also, Hoisting takes place at the time of compilation.

  • @gopipippara7890
    @gopipippara7890 4 года назад

    Great talk

  • @appliedcomputerprogramming5206
    @appliedcomputerprogramming5206 4 года назад

    Great talk. On second thoughts I realise speaker was talking abut execution of call stack and during that myG at one point holds reference to g() as it moves up.
    Btw funny reference to make adder function be on adder is a poisonous snake found in uk/ ( started the king Arthur's war on misunderstanding)

  • @anveshreddy3272
    @anveshreddy3272 3 года назад

    Wow, what a talk!

    • @zummotv1013
      @zummotv1013 3 года назад

      when he is talking about function execution, memory gets allocated in the stack for primitive type?

  • @babitasharma1835
    @babitasharma1835 7 лет назад

    which IDE was used for this ? can anybody suggest?

  • @faithhan7033
    @faithhan7033 5 лет назад

    awesome,good job

  • @imaginarynoise
    @imaginarynoise 6 лет назад

    At 18:19 he gives an explanation that will help anyone trying to comprehend closures.

  • @brinthkr1533
    @brinthkr1533 4 года назад +1

    Awesome❤❤❤

  • @safwanmohammed7715
    @safwanmohammed7715 5 лет назад

    Master piece

  • @Chillouttrance123
    @Chillouttrance123 6 лет назад

    8:54 why it will skipped? When it is not declared with var keyword it will be taken on global platform example window

  • @Welcometomyjourney20
    @Welcometomyjourney20 6 лет назад +1

    Awesome talk. Actually, Javascript when behaving like that everyone was thinking in the past it is stupid language, but with time we discovered this is the power, flexibility & versatility behind js. The guy who invented js is super genius!

    • @phat80
      @phat80 Год назад

      But it was really stupid language when it was invented. It became pretty efficient and productive later. You can thank V8 developers for efficiency for example. And you can find the early language specifications. It had no all these cool things you use now. In fact even ES5 and ES6 has pretty different approach in a development.

  • @Shubham-wz9bx
    @Shubham-wz9bx 7 лет назад

    Superb .

  • @vkiperman
    @vkiperman 7 лет назад +1

    nice! Thanks.

  • @sj82516
    @sj82516 7 лет назад +1

    awesome! Thanks for sharing

  • @debasisdas9534
    @debasisdas9534 3 года назад

    i learnt a lot of things. Before write some code we should know internal things.

  • @dvikauglaumishrauca
    @dvikauglaumishrauca 7 лет назад

    superb

  • @jumbocat805
    @jumbocat805 2 года назад

    what a coincidence! watching this on 23rd September 2021.

  • @franssu2229
    @franssu2229 6 лет назад +6

    "programming is about abstractions" ..two minutes later.. "it's very important that you understand the internals"

    • @zerk6656
      @zerk6656 5 лет назад +5

      Because to implement an abstraction one has to understand the internals)

  • @saurabhvats007
    @saurabhvats007 7 лет назад

    nice video

  • @tanvirahmed7993
    @tanvirahmed7993 6 лет назад

    awesome...awesome

  • @animeshsharma8285
    @animeshsharma8285 5 лет назад

    very helpfull

  • @omarch.9202
    @omarch.9202 5 лет назад

    U nailed it

  • @ankit5970
    @ankit5970 6 лет назад

    Omg from today i am going to believe in js

  • @tejswitaparab2759
    @tejswitaparab2759 7 лет назад

    Hi @arindam
    I have a query declartion "e=1" in f() is unlike b or c, in global scope. Is it the special case?

    • @kalyaninutopia
      @kalyaninutopia 7 лет назад

      That's not a declaration, it's an assignment. The declaration should start with var, let, const or function keyword. e=1 is an assignment which will fail in strict mode with Reference error. In non-strict mode, it will look for the variable e in the local scope and if found assign the value 1 to b, or else it will follow the scope chain till Global object. If it reaches Global object and it couldn't find the variable e declared anywhere then it will create a property e of Global object and assign the value 1, like Global.e =1, window.e=1 etc.

    • @IonidisIX
      @IonidisIX 6 лет назад

      Then i guess he made a mistake by putting variable 'e' in the context of function f() instead of the global scope like he did with variable 'c'. Yes? (I am referring to his slides by minute 19:00)

  • @ArindamPaul1989
    @ArindamPaul1989 8 лет назад +4

    Thanks :)

    • @reachanimesh1
      @reachanimesh1 7 лет назад

      You Rock Bro :) Awesome Lecture !!

  • @mistery4437
    @mistery4437 8 лет назад

    What you mean to say is that Declarations take precedence over Statements and are parsed through first in the 'compilation phase' and then things are put together in the 'execution phase' where statements are brought into play to generate the output? Add to that, variable hiding and forgiving nature of JS, the concept sounds and looks messy. I say that despite the fact that I like JavaScript. Very helpful and highly informative. Thanks a ton.

    • @CliffordFajardo
      @CliffordFajardo 8 лет назад

      +Common Yunus - take a look at this which explains it briefly through guided examples: goo.gl/OOuqej
      Variable declarations are parsed first during the first run through of your program (hoisting also occurs), then during run time assignments and function calls are made.

    • @mistery4437
      @mistery4437 8 лет назад

      +Clifford Fajardo I will and thanks.

  • @e8315402
    @e8315402 7 лет назад

    hey guys, I have a problem about 28:32. Could anyone tell me why adder2's function has a different closure ?? Does it not refer to the same function?? Or I miss something??

    • @rajugangadhar232
      @rajugangadhar232 6 лет назад

      It does hold the same code block. But an entirely new closure will be created for adder2 and the memory allocation references will be in adder2's closure. Which is why we dont see a mixup happening with adder3.

    • @sasuke_2145
      @sasuke_2145 4 года назад

      I think this may be irrelevant for u know after years but will be helpful for someone who is reading comments with same doubt, As Arindam mentioned, ruclips.net/video/QyUFheng6J0/видео.html local execution scope block is created when the method is executed so adder 2 is the holding method which is returned when executing makeAdder(2) whereas adder3 is holding method which is returned when executing makeAdder(3), this means when executing, local scope created for both the adder is different which basically means when u do console.dir(adder2), the scope chain it is pointing will be local execution block of makeAdder(2) and same with adder3, but global scope will be same for both of them, so this becomes like
      globalScope
      / \
      makeAdder(3) scope makeAdder(2) scope
      / \
      adder(3) scope adder(2) scope
      something like this

  • @tamerlan4556
    @tamerlan4556 5 лет назад

    now i get it men

  • @c0mpuipf
    @c0mpuipf 7 лет назад

    which talk was first, this one or the one with "what is the event loop anyway"

    • @RishabhMishra09
      @RishabhMishra09 7 лет назад

      Both are different.
      "what is the event loop anyway" is from JsConf EU
      and this is from JSFOO India

    • @c0mpuipf
      @c0mpuipf 7 лет назад

      Rishabh Mishra yeah but he uses loupe also the code gave as an example with the scope chain was exactly the same as in another talk very likely in the related videos

    • @kalyaninutopia
      @kalyaninutopia 7 лет назад

      Yes you're correct, he lifted Roberts' speech as well, not only the app.

    • @reachanimesh1
      @reachanimesh1 7 лет назад +1

      Please look into time duration 29:06 to 29:11 (ruclips.net/video/QyUFheng6J0/видео.htmlm6s). He did have taken the name of Philips Roberts and also have mentioned clearly that the visualization is done by him. To me, that looked like clear reference :)

  • @Muaddibkhan
    @Muaddibkhan 3 года назад

    What's his name ?

  • @omjego97
    @omjego97 4 года назад

    Great video !! but variable naming could've been better

  • @pulok9909
    @pulok9909 4 года назад

    I said several times Indians are best in teaching.This is extraordinary staff.thanks a lot dada .

  • @duwebuk
    @duwebuk 7 лет назад

    awesome can you make this in hindi / urdu?

  • @heggyhere1374
    @heggyhere1374 7 лет назад

    #JavaScript #scope #closures

    • @heggyhere1374
      @heggyhere1374 7 лет назад +1

      ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-001-structure-and-interpretation-of-computer-programs-spring-2005/syllabus/

  • @divTripathi
    @divTripathi 5 лет назад

    It becomes difficult to follow around 20 mins. But great presentation.

  • @vipsclassicalboy
    @vipsclassicalboy 2 года назад

    wow

  • @jsnmad
    @jsnmad 7 лет назад

    Hmm ... So did Kyle Simpson learn this from Arindam Paul or did Arindam learn from Kyle?

  • @rafadydkiemmacha7543
    @rafadydkiemmacha7543 7 лет назад +2

    Awesome content, funny accent. Especially when he pronounces "g" as "z" 😂

  • @AnisAlam22
    @AnisAlam22 3 года назад +1

    I think in the process of explaining compilation, when he says `var x does nothing` , he missed a point called hoisting. JS compiler pulls variables at the top and initializes them with undefined value.

  • @puneethshivalingaiah
    @puneethshivalingaiah 7 лет назад +1

    :) :) :)

  • @cupojava5056
    @cupojava5056 6 лет назад

    good, sort off

  • @sindhuprasanna9177
    @sindhuprasanna9177 5 лет назад

    Isnt 'c' in the local scope of function 'f' and not in global scope...?
    Good video otherwise... thank you

    • @rajatrao5632
      @rajatrao5632 5 лет назад

      At runtime execution phase ,it cannot find reference for c at the current scope, so it looks up at outer scope and does not find it so it creates the definition for the same (runtime execution phase) i.e var c =4 ; since it reached finally at global scope so value for the same is global..

  • @Algoritmik
    @Algoritmik 6 лет назад +1

    Almost exactly same with this: ruclips.net/video/zRZNb4GDOPI/видео.htmlm29s

  • @americannumber2
    @americannumber2 7 лет назад +2

    lambda not lamda

  • @smarch.1
    @smarch.1 7 лет назад

    another interesting source for variable hoisting :stackoverflow.com/questions/336859/javascript-function-declaration-syntax-var-fn-function-vs-function-fn?rq=1#answer-34995357

  • @prateeksahni2524
    @prateeksahni2524 2 года назад

    Why is variable 'e' not placed in global scope during its first declaration while its similar case 'c' is in global scope?
    I will get a dinner party to whoever answers. 🐱

  • @thomassteindl9481
    @thomassteindl9481 3 года назад

    am I the only one who couldn't follow along?

  • @General_Aladeen
    @General_Aladeen 7 лет назад +2

    an american with Indian accent. hmm weird

  • @apsumin
    @apsumin 7 лет назад +8

    very thick indian accent. hard to follow.

    • @IndianKhanSameer
      @IndianKhanSameer 6 лет назад +2

      Works well for a billion+ people.

    • @rajugangadhar232
      @rajugangadhar232 6 лет назад +4

      Now you know how it feels like to listen to Britain or American or Australian English.

  • @kalyaninutopia
    @kalyaninutopia 7 лет назад +5

    From 30:00 onwards, it's blatant plagiarism of Philip Roberts's JSConf EU 2014 seminar, exact wordings. :)

    • @reachanimesh1
      @reachanimesh1 7 лет назад +1

      Mr. KS what you said is BS :)
      If the concept is same it doesn't matter who says it, it is going to be the same. Of course provided you know the concept and are saying it correct :P
      Mr. Arindam Paul was just Amazing !! Please stop BSing and passing your negativity to others :) Have a great day. Bye :)

    • @kalyaninutopia
      @kalyaninutopia 7 лет назад +4

      Had you attended any university or wrote a dissertation or thesis, you would have unquestionably understood what I was alluding to. You need to cite references. First of all, I never said you are incorrect, I just said it was lifted from another person who had put his precious time and effort to create the content for consumption, the least one could do is to pay due credit to that person, needn't be monetarily but just a few words before passing on the content as your own. There is something called conscience. :)
      Instead of acknowledging the creator of the content, which btw reeks of negativity and feigned superiority, you are trying to ridicule me for pointing that out. You call yourself "geek"! Rightly so, just read about the etymology of the word, you're a perfect example. :))

    • @reachanimesh1
      @reachanimesh1 7 лет назад +4

      Please look into time duration 29:06 to 29:11 (ruclips.net/video/QyUFheng6J0/видео.htmlm6s). He did have taken the name of Philips Roberts and also have mentioned clearly that the visualization is done by him. To me, that looked like clear reference :)
      By the way, it is not me giving the lecture :) I am just an audience who really liked Arindam's lecture and felt bad that you were too busy finding a fault which actually is not correct rather than to appreciate the splendid job he has done :)
      I guess to complete a PhD you do need to write a thesis and I am no exception. So, Yes, I very well know "You need to cite references" :)

    • @vib7777
      @vib7777 7 лет назад

      Even he used the same examples in loupe which was used by Philip Roberts. :D :D

    • @vib7777
      @vib7777 7 лет назад

      totally agree

  • @Poszlakowaneopinie
    @Poszlakowaneopinie 7 лет назад

    irksome accent :(

  • @galmeiri3027
    @galmeiri3027 4 года назад

    Great talk.

  • @babitasharma1835
    @babitasharma1835 7 лет назад

    which IDE was used for this ? can anybody suggest?

    • @rnilu86
      @rnilu86 7 лет назад

      you mean at 26:30? It is just chrome console.