JavaScript ES6 Tutorial #3 - The Let Keyword

Поділитися
Вставка
  • Опубліковано 30 лис 2024

КОМЕНТАРІ • 28

  • @phoenixjohnson-g5i
    @phoenixjohnson-g5i 5 місяців тому +1

    content from 8 years ago, and this is still very easy to comprehend and useful! Thank you!

    • @NetNinja
      @NetNinja  5 місяців тому +1

      Glad it was helpful! :)

    • @phoenixjohnson-g5i
      @phoenixjohnson-g5i 5 місяців тому

      @@NetNinja I learned HTML/CSS AND JavaScript from your page with 0 knowledge of coding! I am recommending you to everyone I know. You deserve more recognition.

  • @leocroft28
    @leocroft28 7 років тому +8

    Wasn't it supposed to log 'undefined' because the variable no longer exists after the for loop is over?

  • @HAIM3307
    @HAIM3307 7 років тому +5

    I still dont understand how numbers are saved to th functions in the loop anyway please help!

    • @DavidShin
      @DavidShin 7 років тому +5

      with let statement, each time for loop iterates, it stores x value to the its own spot in memory. and whenever callback function .onclick is invoked, it knows the spot and the value inside of it. its called closure

  • @SanujBhatnagar
    @SanujBhatnagar 7 років тому +1

    Hey, I didn't understood why the value persisted?
    We didn't created any closer here, still the value of x when defined using `let` acts like we did clouser. How that works?

  • @iquahs
    @iquahs 4 роки тому

    ​ @The Net Ninja hi, i still dont understand how is it that when you use var to declare, the output when you click a list item is 4. I don't understand the process that leads to that output.

  • @alejov
    @alejov 6 років тому +3

    Nice tutorials, And that ninja screams so loud.

  • @mykevin1122
    @mykevin1122 7 років тому +1

    In lexical scope, how is x value ,when logged to console, not overwritten each iteration loop?

  • @md.imranali6305
    @md.imranali6305 6 років тому +1

    You explain so well bro.. thanks

  • @maryamghorbani1333
    @maryamghorbani1333 4 роки тому

    Very clear . Thanks

  • @seddeknadhem5638
    @seddeknadhem5638 2 роки тому

    i have to watch it again ^^

  • @philliprousu652
    @philliprousu652 6 років тому

    What would happen to the number result in console if you clicked the numbers in the order of 3 2 1 0 instead of going up 0123?

  • @prometheusmusic4559
    @prometheusmusic4559 6 років тому

    Thank you for your work, but I still don't understand the difference between the var keyword and the let keyword In the loop. Why is it going such way?

  • @prasadmadushan
    @prasadmadushan 5 років тому

    Great details, keep going. :)

  • @Noldy__
    @Noldy__ 7 років тому

    How did you making your Brackets linter to stop showing linting warnings about Es6?

  • @sergiyrudenko905
    @sergiyrudenko905 6 років тому

    Great!!! Thanks for help!!!

  • @ManuelJordan317
    @ManuelJordan317 3 роки тому

    Excellent tutorial, but has no sense have at 04:37 "x" how global scope. It should be a local variable for the "for" block. Seems "let" is the workaround to resolve this explicitly

  • @lardosian
    @lardosian 7 років тому

    So how did js deal with this before the let keyword was introduced?

    • @pogoking4000
      @pogoking4000 7 років тому +4

      In this specific case you would create a closure when attaching the onclick event. An example way to do this: jsbin.com/jorihikege/edit?html,js,console,output In this example I've named the local variable 'localX', but it would work perfectly with just 'x' everywhere.

    • @lardosian
      @lardosian 7 років тому

      Thank you Mateusz.

    • @abhineet3695
      @abhineet3695 6 років тому

      or you can put the for loop in a separate function and call it everytime someone clicks li.

  • @anatolenavarro6351
    @anatolenavarro6351 8 років тому

    I don't suppose you can do a framework tutorial and how to upload to a server?

    • @NetNinja
      @NetNinja  8 років тому

      +Anatole Navarro Hey - will take a look at this towards the end of the series!

  • @aprodan5245
    @aprodan5245 6 років тому

    SAVE ME NET NINJA!