JavaScript Question: Why are JavaScript Functions First Class?

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ต.ค. 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!

  • @maenam4520
    @maenam4520 7 หลายเดือนก่อน

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

  • @JCMLR
    @JCMLR 6 ปีที่แล้ว +8

    Best explanation so far! *subscribes*

  • @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.

  • @austinabraham1903
    @austinabraham1903 5 ปีที่แล้ว +4

    Thank you, very helpful

  • @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!

  • @FitnessChaos
    @FitnessChaos 5 ปีที่แล้ว

    good explanation chief

  • @TechBison
    @TechBison 11 หลายเดือนก่อน +1

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

  • @RyanScottForReal
    @RyanScottForReal 4 ปีที่แล้ว

    Very useful thanks

  • @jainshilpi3
    @jainshilpi3 6 ปีที่แล้ว +1

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

    • @AllThingsJavaScript
      @AllThingsJavaScript  6 ปีที่แล้ว +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

  • @liyan542
    @liyan542 5 ปีที่แล้ว

    Thumbs up!

  • @Alison-yg6qs
    @Alison-yg6qs 5 ปีที่แล้ว

    thank you!!

  • @chrisplusplus6232
    @chrisplusplus6232 5 ปีที่แล้ว

    thanks!

  • @seenuvasanv
    @seenuvasanv 6 ปีที่แล้ว

    Thanks

  • @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.