What do JS functions really return? And why?

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ก.ย. 2024
  • This video examines the concepts of Immediately Invoked Function Expressions, return statements, what happens to functions without return statements, how to return a function from a function, and situations where your function has multiple return statements.
    Code GIST: gist.github.co...

ความคิดเห็น • 54

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

    Hohoho, it's like a never-ending maze learning Javascript; "What do JS function _really_ return? You thought you knew but, think again."

  • @oah8465
    @oah8465 2 ปีที่แล้ว

    It is a crime this content is free. Huge thank you.

  • @alexbauer1193
    @alexbauer1193 ปีที่แล้ว

    Thank you so much for a thorough explanation. It was hard to find an answer to my question until I visited your video.

  • @quaternion-pi
    @quaternion-pi 4 ปีที่แล้ว +3

    Very useful; clearly explained - thanks for all your videos.

  • @Andrea-lf3jq
    @Andrea-lf3jq 3 ปีที่แล้ว

    I FINALLY get it. Thank you! Binge watching all of your videos. Making my life a whole lot easier.

  • @AshokKumar-dp5rv
    @AshokKumar-dp5rv 4 ปีที่แล้ว +2

    Thanks Steve! Another great video.

  • @rotrose7531
    @rotrose7531 4 ปีที่แล้ว +1

    Thank you as always for these insightful tutorials.

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

    this was really cool and it is great that you explain whats to use of iife

  • @ProgrammingWithOsku
    @ProgrammingWithOsku ปีที่แล้ว

    Thanks very well explained..

  • @srinath7318
    @srinath7318 2 ปีที่แล้ว

    Your videos are so helpull tahnk you so much

  • @chesterxp508
    @chesterxp508 2 ปีที่แล้ว

    Another very cool tutorial!

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

    Thanks for explaining that concept.

  • @soldadopreciso
    @soldadopreciso 3 ปีที่แล้ว

    Thanks pal, useful tutorial.

  • @greeffer
    @greeffer 4 ปีที่แล้ว +1

    ok! now i get it! thanks!

  • @Jawad_Siddiqui
    @Jawad_Siddiqui 3 ปีที่แล้ว

    Thanks great explanation

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

    Yeah, Finally finished this playlist and got too much info hope i won't forget them
    Thanks Steve. Good Job!
    So, what to do Now?)

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 ปีที่แล้ว

      Which playlist did you finish. I have lots of them. I have nearly 700 videos. New videos almost every week.
      Next steps are always to build things.

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

      @@SteveGriffith-Prof3ssorSt3v3 JavaScript from the start . Total 132 videos)

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 ปีที่แล้ว +1

      @@asusbook4034 have a look at JS in the browser next then

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

    Thanks Steve for the clear explanation can you do a video on recursion?

  • @thetahirrehman
    @thetahirrehman 2 ปีที่แล้ว

    I want to return multiple dynamic div in map function into a main id variable to show the divs in main .. but I don't know how to do it.

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  2 ปีที่แล้ว +1

      I have lots of playlists on JavaScript in the Browser, working with the DOM, and the Array functions that will teach you all of that.

  • @tochiskoolofitaly7282
    @tochiskoolofitaly7282 4 ปีที่แล้ว +1

    Was expecting something on functions explicitly return an array if it has to return more than one value.

  • @millanferende6723
    @millanferende6723 3 ปีที่แล้ว

    Hey man thank you for this tutorial! What program are you using for this? I'd love to quickly test out JavaScript code like that. :) Thanks!

  • @DOHandDOH
    @DOHandDOH 2 ปีที่แล้ว

    I like that you teach returning functions from functions. This is an interesting point. But the interpretation of undefined as false and returning only true in case buybeer() succeeds is quite unreadable.

  • @shashikantyadav4599
    @shashikantyadav4599 3 ปีที่แล้ว

    Hi Steve Griffith,
    how to you add >= (≥) or !== (≠) difrent type in vscode.

  • @Tony.Nguyen137
    @Tony.Nguyen137 3 หลายเดือนก่อน

    How can I change my greater equals sign >= just like yours in vscode @5:34 line 11

  • @bvsanchez6161
    @bvsanchez6161 2 ปีที่แล้ว +1

    Honestly get lost halfway but I know with repetition I will get it just takes practice

  • @TiffanyNg100
    @TiffanyNg100 2 ปีที่แล้ว

    subbed so fast

  • @aravindm6124
    @aravindm6124 3 ปีที่แล้ว

    Hello Sir, Great tutorial , your thoughts on how to progress on logics in javascript like working on array, control flow statements etcc....i find it difficult to understand the logics and it takes lot and lots of time to learn few logics, your thoughts will help me,.....Thank you Sir, you are great

    • @aravindm6124
      @aravindm6124 3 ปีที่แล้ว

      Hello Sir, your inputs will be invaluable,please do share ur view when you are free, Thanks again

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 ปีที่แล้ว +1

      I have playlists on lots of topics. If you go to the playlist area from my channel homepage you can see all the groupings. The JavaScript from the Start list covers all the fundamentals.

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

    Is this correct? : Doing it this way each time you call the iife, each obj will have it own functions and doing it with prototype all obj will have same functions.

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 ปีที่แล้ว +1

      They both have appropriate times to be used. An iife typically gets used to create a single object. It has a closure that protects variables and functions that are nested inside. Those items cannot be altered later. Think - your initial app object.
      Prototype methods are meant to be shared and used when you are creating multiple objects.

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

      @@SteveGriffith-Prof3ssorSt3v3 im sorry, i worded my question very poorly. I meant to ask if i understood to differences correctly. I wanted to know when doing it this way, the properties would be in the prototype or just be normal properties? Its better to use prototype when there are multiple instances and its better to use this when there is only one instance.
      I have seen ()(); syntax in a lot of projects and libraries and they always confused. i didnt knew how to google them cause i didnt know what they are called. Thanks man, your videos are really helpful to me.

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

    Where to find this '≤' ?
    thanks or the video.

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

      @Basheer Hallak there are fonts you can use that have ligatures. If you set your VS Code font to FiraCode you will get the same result. Hope this helps.

  • @unknownman5498
    @unknownman5498 ปีที่แล้ว

    wow babe

  • @samuelmatheson9655
    @samuelmatheson9655 4 ปีที่แล้ว +2

    This is what happens when you design a language while high...

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

    What should I learn to develop my own commercial website

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 ปีที่แล้ว +1

      For a commercial website you need a little bit of everything - client side html, css, and javascript. Serverside you need some way of storing data, which means databases of some kind like MongoDB or MySQL, plus a serverside language like NodeJS or PHP, plus security for managing data of user accounts and security for handling purchases.

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

      @@SteveGriffith-Prof3ssorSt3v3 I started with JavaScript learning
      Two weeks ago
      I got a confused suddenly
      Should I switch to php now?
      Very confused
      Basically I am a mechanical engineer
      So please forgive if my questions are wrong
      Looking for your suggestion after HTML and css

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 ปีที่แล้ว +1

      @@prabu2778 No. Don't switch. PHP is just one option for serverside programming. There are lots of choices to make for the different ways you can build the back end of a website.
      Two weeks is nothing. There are lots of courses and bootcamps that will say that they will make you a full stack developer in 10 weeks. But honestly it takes years before anyone can be competent enough to use all the different technologies on the client side and server side and dev ops so that they can build anything more than a basic website at a professional level. After a 10 week bootcamp you can get a job as a junior level developer building websites. That means you are working under the supervision of a senior developer who does have the years of experience.
      It doesn't matter what you are learning, as long as you are learning.
      In 25 years of doing this I have never spent less than 5 hours in any week where I wasn't learning something new.

    • @prabu2778
      @prabu2778 4 ปีที่แล้ว +2

      @@SteveGriffith-Prof3ssorSt3v3 thanks sir for typing this huge paragraph
      Sorry sir for stressing you
      Okay well then I will continue with my JavaScript sir
      Very helpful sir

  • @vicdelgui86
    @vicdelgui86 ปีที่แล้ว

    I really didn't understand anything you said. Really frustrating :(

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  ปีที่แล้ว

      Sometimes with programming you just need to repeat topics until the abstract topic sticks in your mind. Different people will get stuck on different topics for different amounts of time.

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

    +++

  • @julienbongars4287
    @julienbongars4287 2 ปีที่แล้ว

    You should replace your click baity title with "JS Functions that return Functions" so that you don't waste my time.