JavaScript Question: Why are JavaScript Functions First Class?

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

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

  • @eieiei649
    @eieiei649 4 года назад +2

    Teaches you what you came here for, no beating around the bush whatsoever. Thanks!

  • @RameenFallschirmjager
    @RameenFallschirmjager 4 года назад +5

    Your videos are such rabbit holes! When you watch one, you need to watch others too!😂

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

    I never ever seen teacher like you.!

  • @hiteshj2110
    @hiteshj2110 5 лет назад +3

    This cleared A LOT OF BASIC which I needed the most. Thank you so much. Very well explained.

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

    Such a great teacher! Thank you so much for making these tutorials clear, to the point and easy to understand!

  • @JCMLR
    @JCMLR 6 лет назад +8

    Best explanation so far! *subscribes*

  • @maenam4520
    @maenam4520 8 месяцев назад

    Great explanation going to see all available videos on your channel.
    Thanks

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

    On 02:00 you say "when you place variable in a function"...But you really placed a function in a variable. Am I wrong, or is tat a lapsus?

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

      Yes, you are correct. I placed the function in the variable and meant to say that. :-) Hopefully that didn't mess anyone up.

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

    Loved your explain. This explanation with examples finally made me understand first class functions.

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

    very clear explanation, thanks.

  • @TechBison
    @TechBison 11 месяцев назад +1

    This is where you learning JavaScript deep but easy....

  • @austinabraham1903
    @austinabraham1903 5 лет назад +4

    Thank you, very helpful

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

    good explanation chief

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

    Finally, I got it! Thanks a lot.

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

    I appreciate this video, but I think a very important piece wasn't stressed enough. I could be off base on this, so obviously correct me where I'm wrong, but to me this doesn't make any sense, (or its meaningless ) If I'm not familiar with the idea of
    int myNum = 123
    string myString = "hi"
    float myFloat = 123.123
    And not being able to do -
    myNum = myString; (won't compile it most languages)
    The important part is JS doesn't decipher between primitive data types and objects/functions. And this is all seen first hand with the code you wrote with one word. VAR! Var is the "feature" that allows functions to be first-class.. no? I feel like Var should be the takeaway. All of the code you wrote could of easily been replicated in many languages but very few that I'm familiar with could of done it by only using one "data type"

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

      I hope I'm understanding what you are getting at, but var is not really the magic sauce. We can define it with let or const. We can also do a regular function definition. It is simply the fact that a function can be assigned to a variable and then passed around. Simple example:
      function test() {console.log('test');}
      const t = test;
      t();

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

      ​@@AllThingsJavaScript Yes, you are right. Maybe I didn't describe myself well. My point is the idea of "first class functions" I think is very hard to understand without knowing the alternative. Without having some familiarity with programming languages where functions aren't "first class". Any language, first-class or not, could have created the same functionality as you did in this video. But they couldn't have done it with one universal, one size fits all "variable" (var, or let, or const). Data types would have to be defined and respected. If you wanted to pass the value 123 into a string variable, operations like casting would have to be done to make that happen. It doesn't just happen, like in JS. So yes, var specifically isn't the special sauce but the absence of any other data type is the special sauce. And a new programmer without having experience in a language like java or c++ isn't going to appreciate the benefit of var myVar = "Hello World", without first stuggling to make int myVar = "Hello World" compile.

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

      @@adamrohde3513 Got it! Thanks for your input!

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

      @@AllThingsJavaScript And thank you for creating the content!

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

    Very useful thanks

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

    can u make some tutorial making? a small application using OOps concepts of javascript

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

      I will add that to the list. It may be a while as this takes more time, but if you need this right away you can check out my advanced course: www.allthingsjavascript.com

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

    very helpful thank you!

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

    Thank you

  • @Alison-yg6qs
    @Alison-yg6qs 5 лет назад

    thank you!!

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

    thanks!

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

    Thanks

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

    Thumbs up!

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

    Javascript can be a bit confusing. Functions are typeof Objects but are treated as values!

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

      The way I think of it is objects can be passed around in JavaScript like values.