Why iife appears in javascript interviews

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

КОМЕНТАРІ • 170

  • @vaidhyanathansm7625
    @vaidhyanathansm7625 3 роки тому +387

    Accidentally, I read it as "Why life appears in javascript interviews" LOL 😂😂😂

  • @RanchoRoshan
    @RanchoRoshan 3 роки тому +50

    Such an illusion of eye..nearly everyone read the title as 'Why life appears in Javascript interviews'😃

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

      My first thought, "Life? What Life?"

  • @know_krishna
    @know_krishna 3 роки тому +21

    We need a mock Interview from you. What type of questions you will ask in an interview. If possible we will want to the answers in your own way :) This will helps for many people in their IT carrer.

  • @SriHarshaChilakapati
    @SriHarshaChilakapati 3 роки тому +2

    A big use of this is when you want to use async/await everywhere in your code, and then in that case, I can write it as
    (async function main(arg) {
    try {
    let result = await somethingThatReturnsPromise(arg);
    console.log(result);
    } catch (e) {
    console.error(e);
    }
    })(someVal)
    But it is as simple as it gets. ((a) => console.log(a))(10) is a very simple example that I give in interviews. There is a function expression and I'm immediately executing it without assigning it to any binding. Great video!

  • @sisansahu5538
    @sisansahu5538 3 роки тому +5

    Really after quite a while the intro of LCO is really awesome, this is the best till date!

  • @srijanpaul
    @srijanpaul 3 роки тому +12

    I understand that the intent of this video is to teach newbies about IIFE, and I appreciate the effort :) . But this just gets some basics wrong and misses the entire point of IIFEs. So for those watching:
    1. IIFE is Immediately Invoked Function *Expression* (not Evaluation)
    2. IIFE isn't a "style of coding", it's not a personal preference thing. It has very specific use cases (eg- code injection without risking clashes with global namespace)
    3. *What is an IIFE?* The explanation of IIFEs is incorrect, the thing inside braces isn't a "callback", it's the opposite. It's an inlined function call. An IIFE is simply an anonymous function definition that is called immediately in place.
    4. *Why use IIFEs?* Since this is for beginners, let's just imagine you want to run some code in the browser console in an existing web app. Now suddenly you have restrictions on variable names, because if you call your variable 'x', there might already be a var with that name declared by the original authors of the site. What you want is a lexical scope to shadow the outer declaration of 'x', that's where you use an IIFEE. There are only a couple more use cases where IIFEs make sense. In general it's not a "style of code", and is instead considered a code-smell.
    5. *Why are the 'require' imports made at the end?* If you look carefully, you'll quickly understand what's happening is really the 'require' calls are the arguments to the anon function that is being called. You don't need to put them there *at all*, you could just have the parameter list and argument list be empty, and make the calls to 'require' inside the function body.
    I hope that helped. :)

    • @HiteshCodeLab
      @HiteshCodeLab  3 роки тому +1

      I hope by seeing the length of this comment everyone can imagine that if I cover what is iife and why we use iife, video would be little more than 30 mins. These titles are probably for future. Right now, just a mini case that it’s an important part, even if it’s not much used as regular.

    • @charanpresence1481
      @charanpresence1481 8 місяців тому

      This comment really helped, thank you!!!

  • @devanshsinghparmar
    @devanshsinghparmar 3 роки тому +1

    Some People ask that we have to go with him or not?, MY ANSWER, I Guess this question, doesn't matter, No one else like him, You have a chance, grab it, his courses are wonderful, I really didn't know about programming that much!, He Helped, No One else, he is a star in my life, God sent him for us, Grab it right Now, Question doesn't matter!, GRAB! GRAB! GRAB!

  • @RidwanurRahmanextreme
    @RidwanurRahmanextreme 3 роки тому +14

    'Why life appears in javascript interviews', that's what I read two times wondering!

  • @rayyanrasheed8010
    @rayyanrasheed8010 3 роки тому +1

    3:49 This is one of the best reasons, Why I watch your videos as much I can.

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

    Everytime in Morning when i watch video. It makes my day.
    More specifically it makes me feel that I'm developer. I make beautiful things for beautiful world.
    From Gujarat

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

    your teaching style and videos are nice many new things I learn from it..thank you sir

  • @firefly8928
    @firefly8928 3 роки тому +7

    You are opening so many puzzles for us. Thanks for your efforts🙏🏼

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

    I really like this video, immediately after covering this topic in a course I came over here to get more clarity on this. Thanks a lot for this video sir.

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

    Thank you hitesh.You are cooking contents very well which tastes simple and digestive.

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

    Opened the youtube, was about to search something and on the left corner saw the thumbnail. that was enough. though i got confused IIFE with LIFE... THANK YOU for the video sir. learned something new........

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

    your communication skill is OP😀😀

  • @kushbosamiya9671
    @kushbosamiya9671 9 місяців тому

    00:05 Understanding the importance of IIFE in JavaScript interviews
    01:43 Understanding IIFE is important for reading and collaborating on others' code
    03:19 Understanding the importance of IIFE and its application in coding
    04:55 Setting up server using Express in package.json
    06:33 IIFE allows for immediate execution of code.
    08:15 Creating and utilizing templates in Javascript
    10:01 Starting the server and handling errors in JavaScript
    11:51 Introduction to IIFE writing code

  • @vibhugautam5093
    @vibhugautam5093 3 роки тому +1

    Hi Hitesh,
    Big fan of yours!!
    Just a suggestion since most of the people now watch your videos on phone can you try once shooting the video in 18:9 aspect ratio rather than 16:9 as phone screens are becoming wider and taller

  • @HarshSingh-hk8fe
    @HarshSingh-hk8fe 3 роки тому +1

    Sir In your javascript course on youtube you mentioned about it as self executing functions
    Sir please upload these kinds of videos as noone talks about it but you really working hard for us, so we are 💯💯❤🙏🙏

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

    It was really new .... I even listened thus word for the first time

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

    These videos are the best kind

  • @maheshmurugan5527
    @maheshmurugan5527 3 роки тому +1

    You have already talked about this in .. new js course ... ♥️

  • @siemen_subbaiah
    @siemen_subbaiah 3 роки тому +17

    I misread the time has : why life appears in JavaScript interviews😅

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

    Before this video i was watching your video of self executing anonymous function in js that's mind blowing you have already talked little bit about it

  • @MukeshKumar-of9zh
    @MukeshKumar-of9zh 3 роки тому

    3:35 but it got a click bait with the illusion sir, "Why life appears in JavaScript interviews" 😂😂😂😂 and great video, learned a new thing in life #iife!

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

    Hitesh Sir, Content is informative and keep uploading these types of videos.

  • @hiteshsuthar1097
    @hiteshsuthar1097 3 роки тому +8

    I came here through Ur JS tutorials playlist after seeing a new video at bottom :D

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

      Same!

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

      So how was that ?? Was it worth to watch

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

      @@Oldstoryhouse 💯 sure! Go for it.. if U want to learn JS above beginner's level..
      Content quality is as good as his English fluency as well as examples...
      Btw It's about 10hr course so U won't miss any thing like other 1-2hr crash courses.

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

    thank you Hitesh 👍

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

    excited learn these kind of tricks in JS

  • @sudo-abhinav
    @sudo-abhinav 3 роки тому +2

    thanku sir for quality content 🙏❤️

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

    Very informative video ,this one 😊

  • @muskanmall4401
    @muskanmall4401 Рік тому

    thank you!

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

    Thank you for making these videos 💓

  • @damareshwarakumar
    @damareshwarakumar 3 роки тому +2

    Is there any extra advantage of following IIFE style

  • @suryap999
    @suryap999 3 роки тому +1

    Why life ? 😉 IIFE

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

    Great explanation of the syntax but I don't think the original question was answered! I still don't know what the key aspects about IIFE are that make it such a common JS interview question. Is it just that we may need to know the syntax in case one of our teammates prefers this syntax?

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

    I was not aware of IIFE thanks sir :)

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

    First time hearing IIFE. Like IIFE any other. Give the titles I will Explore.

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

    Thanks

  • @JobinSelvanose
    @JobinSelvanose 3 роки тому +1

    is studying this method only advantage for interview only or is any other advantages

  • @CREATIVEEXPERTZ
    @CREATIVEEXPERTZ 3 роки тому +1

    Thanks Sir

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

    You are Akshay Kumar for Programming World ❤

  • @rajeshbhattarai5934
    @rajeshbhattarai5934 3 роки тому +2

    ( .... )(
    require ("hitesh-sir"),
    require ("more such content")
    )

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

    Really helpful ❤️

  • @Playerofplayconsole
    @Playerofplayconsole 3 роки тому +1

    Sir ji compress app size in flutter
    Please sir ji

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

    please make videos of aws....
    we all are waiting for that

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

    Didn't get the intuition behind the name where is "instant invocation" part of iife

  • @samirkrishnach3691
    @samirkrishnach3691 3 роки тому +1

    Enjoyed

  • @risehoneix9445
    @risehoneix9445 3 роки тому +1

    Hy, Hitesh can you make a video about how does a interviewer search in a candidate

  • @mrvaibh0
    @mrvaibh0 3 роки тому +3

    Got 2 notifications,
    IIFE concept - Hitesh Choudhary
    Family Man Trailer - Amazon Prime Video
    Me: *Clicked on IIFE

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

    How can we write this in iife👇
    const session
    =require('express-session');
    const mongoSessionStore=
    require('connect-mongodb-session')(session)
    As connect-mongodb-session require session obj as a input .

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

    Thanks 👍❤️

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

    Where can we get your mousemat?

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

    Why it is said that Ninja code is tried by all but only doable by some?

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

    Hello sir, Thank you for such a informative video. I need your guidance to start my career in cloud. I just want to communicate with you. How can I start the career in cloud computing? waiting for your prompt response!!!

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

    Hi hitesh your content is great,I have 4 years gap and I learned python and angular, what do u suggest like how to proceed with career

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

    Please make about shopify.

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

    I started to find what's the meaning of appears really!

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

    So what is the advantage of writing the code in this style rather than normally declaring the variables like const express = require('express') and then using them like that? Like why should i use this iife style over the regular style?

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

      We use IIFE when we want some data members of the function to be completely isolated or private in the program, that is the variables don't take any value from outside the iffe function.
      The second thing is that they get invoked as soon as the program is run that's why called 'immediately invoked...'
      In case we want some portion of code to get executed as soon as the code runs IFFE comes into rescue!

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

      @@kashifahmed_1995 thanks ill make sure to research more about these

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

      @@khushi_jha16 Its on you but rarely it is asked in interviews

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

    Sir Make Video on Google IO 2021

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

    Sir do make this kind of videos

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

    Now I'm overwhelmed what's else do interviewers asks that no one is talking about
    Ever going path of learning...

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

    I see this code in a project a week ago.

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

    Interviewer: Tell me about iife.
    Me: My life has been great as I came to this city of dreams...
    interviewer: hired.

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

    I think now I get why many don't talk about it. It doesn't serve much utility value. It's obviously Little painful to write and read it.

  • @Sky-yy
    @Sky-yy 3 роки тому

    Amazing

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

    3:54 it will get views, because of your magical title

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

    🙌🏻👍🙌🏻

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

    How IIFE is different from destructuring?

    • @srijanpaul
      @srijanpaul 3 роки тому +1

      They're entirely different constructs. Destructuring is merely a way to assign to multiple variables from a single object without having write comma separate declarations (or different 'let' statements).
      IIFE is a way to execute code as soon as the script is loaded, without polluting the global namespace with variable names.

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

    Why are you using body-parser.. It is depreciated

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

    I watched your video in which you talked about , something when company say they will teach you and give you minimum assured package of sat 5lac then take money from you about 15% of your salary, I remembered you talked about it I wanna watch your views again but I cant find that video can you please help me Thankyou

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

    Now you don't require body-parser because now express comes with in built body-parser.

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

    Express provide his own body-parser you don't need body-parser package express. json( )

  • @MIKE_FITNESS.
    @MIKE_FITNESS. 11 місяців тому

    Bro say slowly I loved script❤😂

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

    Finally you got hair cut😁😁,in this lockdown

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

    Thank you!❤️

  • @nadeemqureshi9779
    @nadeemqureshi9779 3 роки тому +1

    Honestly, i just didnt understand when you started to explain what exactly is IFFE ? I am sorry, I didnt understand what is IFFE.

    • @srijanpaul
      @srijanpaul 3 роки тому +2

      It's a poor explanation really; I'd advise you to move over to the MDN pages (or javascript .info). There you'll find a much more in-depth explanation.

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

      This is not, what is iife video. That’s a separate video in playlist. This video serves the purpose to awareness towards iife.

  • @SperkSan
    @SperkSan 3 роки тому +2

    Thanks for the info which I am probably not going to need in my life 😂😂

  • @RajveerSingh-yb6zq
    @RajveerSingh-yb6zq 3 роки тому

    when he says I know I am going too fast... .and You are watching it on 2x :)

  • @sid4752
    @sid4752 3 роки тому +1

    Hey Hitesh,
    What do you think about learning Swift iOS development in 2021?
    Everyone I see and every internship I see only lists react native or flutter as a requirement.. but when I search internationally swift is still super dominant.
    So what do you say about this?

  • @technicalom9359
    @technicalom9359 3 роки тому +1

    I have enjoyed video but it's not 100% enjoyable without your vs code theme video, please it's over due than covid19...

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

    first first ❤️❤️❤️

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

    I got to know it's iife not life after reading the comment section. 🤨

  • @ex-machina7685
    @ex-machina7685 2 місяці тому

    i subscribe your video

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

    The word iife is misunderstood as life. As iife I'm hearing it for the 1st time.

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

    4:10

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

    how many of you read iife as life
    me too

  • @AbhishekChoudhary-tu7ig
    @AbhishekChoudhary-tu7ig 3 роки тому

    Support++

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

    I'm not the only person who read iife as life. 😂

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

    That company must be Razorpay

  • @hitengoyal5457
    @hitengoyal5457 3 роки тому +2

    Another JS video. Pls make some videos on something other than JS. 🙄

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

      I completely agree with you. But I guess more number of audience from this channel are for JavaScript content

    • @hitengoyal5457
      @hitengoyal5457 3 роки тому +1

      @@siemen_subbaiah This is bcz he makes content for JS only as he knows JS.

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

    I see you got a nice haircut 💈

  • @Abhishek-tr4oi
    @Abhishek-tr4oi 3 роки тому

    Who else read iffe as life😂

  • @Nikhil-qi4oz
    @Nikhil-qi4oz 3 роки тому

    1st comment

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

    First

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

    Hi 👋,

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

    First comment

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

    First veiw 😎 is

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

    ahaaa haircut

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

    1st View