Tricky JavaScript interview questions and answers

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

Комментарии • 1,1 тыс.

  • @vinodhkumar457
    @vinodhkumar457 7 лет назад +82

    This one is important for JS developers.

    • @Techsithtube
      @Techsithtube  7 лет назад +6

      Thanks for watching ! :) Thanks for the support ! )

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

      Very helpful, your you defeated the Google beast

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

    5 years later and this video is still relevant. I didn’t watch it fully this time… but I do remember everything about it vividly. An absolute classic❤

  • @vinikett9114
    @vinikett9114 4 года назад +4

    Brother you are one of the most efficient teachers for teaching programming on youtube that i could find.You explain concepts really well.Its sad that youtube is doing this to constructive youtubers like you.You have all my support!

  • @zajebojca
    @zajebojca 7 лет назад +37

    This question with "returning total number of arguments" can be solved in much simpler way.
    const x = function(){
    return arguments.length;
    }
    The object 'arguments' has property ''length'.

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

      You are either wrong or you mean the opposite.
      the below returns 4
      function x(a,r,t){
      return arguments.length;
      }
      console.log(x(5,5,6,7))

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

      you can count formal parameters (aka "required arguments") with function.length, not arguments.length, which is a count of what's passed.

    • @kamoroso94
      @kamoroso94 6 лет назад +1

      I was thinking the same thing, but also what's the point of no loops? How would a loop even help solve this problem lol.

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

      output will be 4

    • @ravikumargrandhi6315
      @ravikumargrandhi6315 6 лет назад +1

      x(.....) function will return how many arguments you are passing while calling x(....).

  • @rojiherrera
    @rojiherrera 7 лет назад +21

    "This is an INTERVIEW, not a RACE" -techsith ☝️

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

    For getting total number of arguments, in ES6 we can do
    let x = function (...args) {
    return args.length;
    }
    and for the method chaining we can use
    return this;

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

    To print the length of arguments (17:33), we can simply write:
    return arguments.length;
    inside the function instead of using Slice method.

    • @Techsithtube
      @Techsithtube  5 лет назад +1

      That is true Arjun. Slice helps to convert argument to an array and then you can use other array features like join() and things.

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

    This is great, I have a couple of job interviews next week for JavaScript roles and you have really helped me to build my confidence in preparation for this. Please keep posting videos :-)

  • @pavelerokhin1512
    @pavelerokhin1512 6 лет назад +22

    There is no inappropriate content in this video, dear RUclips

  • @vladanng
    @vladanng 6 лет назад +1

    What a fantastic videos. I remember watching your one year ago it feel like nostalgia, because i spend hours and hours watching your videos, trying to understand things. For now, i did not find better one tutorials on JS stuff on youtube at least. Just fantastic.

    • @Techsithtube
      @Techsithtube  6 лет назад +1

      Thanks for watching and welcome back !

  • @tochukwuibe2139
    @tochukwuibe2139 6 лет назад +3

    Getting ready for my first interview, your content is really helpful

    • @Techsithtube
      @Techsithtube  6 лет назад +1

      Good luck with your interview. !

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

    I am following you since couple of months.. You are champ man. Keep it up.. 1000 likes from my side

    • @Techsithtube
      @Techsithtube  7 лет назад

      Hi Subrat, thanks for watching! :)

  • @xuelianwang5300
    @xuelianwang5300 5 лет назад +5

    Very interesting JavaScript question! Thank you for sharing!! Thank you for taking time and effort to make so many nice JavaScript videos!

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

    Thank you for helping strangers! I hope RUclips does right by you and you can keep the videos coming. They're a great help.

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

    I've been watching your videos over the past few days and they've been extremely helpful and informative!

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

    I'm finding all your interview videos helpful. I have my first ever on Monday and feel much more confident going in.

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

    Love those tricky questions, we actually keep learning :)

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

    RUclips's algorithm is so stupid. Your videos are good quality and don't deserve to be demonitized.

  • @momentswithmanisha
    @momentswithmanisha 4 года назад +3

    I learned new things. Thank you clearing my Concept 😇

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

    Your all videos so far I have been seen are really deserves thumbs up ( 👍 ), Please keep doing your good work... and hope RUclips should not harm you.

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

    Thanks for tricky question - didn't aware of this magic

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

    You helped me a lot in job interviews.
    Actually I am preparing for an interview right now with the help of your video.
    Thank you!

  • @theinternetcash
    @theinternetcash 6 лет назад +3

    my first javascript interview coming up very soon

  • @astro-zodiac
    @astro-zodiac 2 года назад +2

    6:10
    That's a cool trick to impress your co-workers,
    If they dont know it 😂😂

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

    Best Interview series!

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

    The reason you cited why the interviewer asks such weird questions are all very correct.

  • @ryanlozon5712
    @ryanlozon5712 6 лет назад +7

    Please keep up the awesomeness.

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

    Thanks for your work.
    console.log(arguments.length);
    vs
    console.log([].slice.call(arguments).length);

  • @jakekim1442
    @jakekim1442 6 лет назад +3

    Awesome tutorials man.

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

    @17.25, a more concise solution is: const x = (...rest) => rest.length;
    Awesome video, Techsith. I'm 100% subbed 🏆🎊. Most of these questions really had be thinking haha

  • @Toni7926
    @Toni7926 7 лет назад +3

    Nice video, keep up the good work! (:

  • @DevRaj-tk3kc
    @DevRaj-tk3kc 6 лет назад +1

    Nice tricky questions. These are proper genuine content videos.

  • @SK-ur3hw
    @SK-ur3hw 7 лет назад +5

    Great interview questions 👍🏻

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

    This is one of the best channel to advance your JavaScript.

  • @vlad981
    @vlad981 7 лет назад +4

    Thanks! Great video!
    Hope RUclips will change its policy, keep it up please)

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

    What a great video. I had my hand over my head all the way. Like I would literally fail all the questions without your solutions. Thank you so much.

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

    Hi,
    For simplicity of typing I have used iife...
    Why you have done like this ? any benefit?
    (function x (a , b, c, d) {
    return [].slice.call(arguments).length;
    })(1, 2, 3, 4);
    Instead of simply returning length of arguments array like-
    (function y (a , b, c, d) {
    return arguments.length;
    })(1, 2, 3, 4);
    Thanks,
    Rahul

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

    Thank you so much for this. It's interesting to hear your perspective on these tricky questions and I appreciate your openness and honesty about youtube monetization

  • @Fikayoz
    @Fikayoz 7 лет назад

    Thank you so much for this video! I hope this channel grows even larger!

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

    Dude I love the videos you're really helping me and many others on our Dev path

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

    Best RUclips channel for JavaScript interview

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

    Awesome man. Want to see more interview tricky question series. Awesome job.

  • @MrVisheshsingh
    @MrVisheshsingh 7 лет назад

    Thanks for the video. We all support you for all the hard work you are doing!

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

    im glad you fixe YT problems for ads...your videos eally helpme a lot thanks👏

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

    @3:26 now I fully understand how styled components work. You are such a good teacher

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

    This is very helpful. I am conducting JavaScript interviews in the next couple weeks. This has been a great resource (along with your other videos).

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

      Thank you for watching Ryan. Good luck with your interviews!

  • @christmasvillage3652
    @christmasvillage3652 5 лет назад +2

    your videos are awesome and RUclips is very discouraging. Keep up the good work sir.

  • @nancycreeksong9879
    @nancycreeksong9879 5 лет назад +2

    Techsith videos have been very useful to me. Thank you.

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

    That thing with contentEditable blew me away! Awesome trick!

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

    Amazing! The String constructor one was cool haha

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

    Great content!! I am preparing for an interview in a couple days and your videos are a huge help!!

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

      I am glad Adam . thanks for watching!

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

    Really helpful video! We need more of those on RUclips!

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

      I have a plan for more such videos. keep an eye on the channel for that.

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

    question : function return total number of arguments. // do not use loops.
    let x = function(){
    return [].slice.call(arguments).length;
    }
    Below one is more simple :
    let x = function(){
    return arguments.length;
    }

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

    I'm studying my interview with your videos. If I pass, I will edit my comment and I hope it's going to be well because the videos are very great. The contents are preparing the audience to the tricky and hard questions. Especially the ones that include mock interviews. Keep it going!

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

    I am already subscribed to your channel and I get alerts but I wanted to let you know that I really appreciate your content thank you for making videos and posting them for us!

    • @Techsithtube
      @Techsithtube  7 лет назад

      Ernest , Thanks you for watching! :)

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

    Super helpful video while Im studying for a job interview

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

    Appreciate & yes maximum people make a list of questions to ask from the internet for the interviews & then start expecting the answers for those questions from candidates & in reality maximum interviewers also dont have any freaking idea for those answers. But current interviews have become a race, a questions/answers session, a Viva.

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

    Thankful for good bunch of Interview questions ons JS.

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

    You're awesome, your videos are helping me a lot. If I pass my interview tomorrow I'll become a patreon. Thank you very much!

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

      Good luck with your interview Andrea. :)

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

    function a() {
    console.log(arguments.length);
    }
    Above will also work for arguments length.

  • @sam123sujeet
    @sam123sujeet 5 лет назад +1

    Really like this tricky interview questions series. Keep posting it

  • @nandac2820
    @nandac2820 5 лет назад +1

    This video is great but and your explanation is good.
    I really did't understand the concept of asking these kind of questions in interview. Until and unless you faced these kind of scenarios in real time you never know the answer. I do have some decent experience like 6+ in JS but I faced these situations very rare when we work on framework. (9 out of 10 developers dont remember things after fixing an issue)
    So if some one answered these kind of questions means they saw these videos(assume {some number} out of 10) or read somewhere. So what are you interviewing real time experience or some interview preparation ?
    As an interviewer I will ask concepts(not these tongue twisters). architecture of application/framework and mainly approach on solving problem and wiling to learn.

  • @MrErererererr
    @MrErererererr 5 лет назад +2

    Thank you. I have my interview tomorrow and if I pass it, it thanks to you.

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

      Did you pass?

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

      Plg send me the question I don't have idea I prepared the interview my email id kamalrajawat870@gmail.com I have prepared in web development plg text all questions

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

    Hi Sir, Your javascript interview part of videos are very helpful. actually I have found an another way in that question of function return total number arguments
    you have explained like
    function x(){
    return [].slice.call(argunments).length;
    }
    x(1,2) // 2 length
    Found another way is
    arguments is a array like object
    it has number of array of arguments of function
    function x(){
    return arguments.length;
    }
    x(1,2,3) // 3
    simply we return arguments.length that will give lenght of arguments of function
    am getting answer for this way too..
    Thanks once again sir.

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

    Thanks for the tips! I hope I am not running into any of the questions in my interviews, but it is so good to know.

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

      Its important to know these questions. Most of the times people wont ask such questions but you might one or two people who would ask such silly questions to throw you off.

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

    You are really driving up my love/hate relationship with JavaScript.

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

    I did not know about the contenteditable attribute!! It's awesome

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

    about function returns total number of arguments: Isn't it easier doing something like the following? Thanks!
    let x = function(){
    return arguments.length;
    }

  • @sanjaysingh-sy6zu
    @sanjaysingh-sy6zu 5 лет назад +1

    Thanks for making this video which helps me understand tricky concepts of JavaScript. Thanks a bunch

  • @ephdawg3374
    @ephdawg3374 6 лет назад +1

    Thanks for your videos, they are always so helpful. Learned some great things from this one !!

  • @indianhikinggirl
    @indianhikinggirl 5 лет назад +1

    Please come up with more videos of this type. It would be very helpful for interviews. Thanks

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

      I have a whole series of such videos. do check it out the playlist

  • @shridhargovindaiah
    @shridhargovindaiah 6 лет назад +1

    Excellent Video. We support you and we need more educational video from you.

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

    u have gr8 knowledge on Javascript. I am learning a lot from u. I am looking forward for more technical videos from u.

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

    I am a new subscriber, and I can tell you that I love your content and videos... It is awesome!!! keep up the great work :)

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

    Grear video! Always putting out worthwhile content😁

  • @6keff
    @6keff 7 лет назад

    Excellent video!, I didn't knew about content editable property until now. Thanks!

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

    Come on youtube this is an educational channel, please remove restrictions.

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

    Awesome Video! A fun way to practice JS for coding interviews

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

    Thanks a lot for this video, you are really unique with this content!

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

    we can get the total number of argument simply using arguments.length right?
    let x = function(){
    return arguments.length;
    }
    console.log(x(1,2,3,4,5))

  • @AB-tx7eh
    @AB-tx7eh Год назад

    5 years later still a great content ✨

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

    The way you explain the JavaScript are really awesome.

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

      Glad you think so! Thanks for watching!

  • @shwetapaliwal2424
    @shwetapaliwal2424 5 лет назад +1

    seriously very much needed video for developers

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

      Thank you shweta for a nice comment! :)

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

    Very nice and useful one. Techsith really helping the community...

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

    techsith, your videos are amazing!

  • @swethas7320
    @swethas7320 5 лет назад +2

    Good video to understand JavaScript concepts in depth

  • @redraushan
    @redraushan 7 лет назад

    For the second last question, why would you do that way even though the following simply works fine?
    let x = function(){
    return arguments.length;
    }
    x(1,2,3);
    // returns 3
    Just quickly tested in jsfiddle

    • @Techsithtube
      @Techsithtube  7 лет назад

      yes. that would be a valid answer as well.

  • @rampande5830
    @rampande5830 5 лет назад +1

    found tutorial very useful. Learnt new things in JS. Thank you.

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

    Thanks for your videos, they are really helpful.
    For the question related to number of arguments ...i could simply also do the below
    var y = function() {
    console.log(arguments.length);
    };
    y(1,2,3,4,5);
    Any specific reason for using [].splice ......

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

      yes you could simply use arguments.length

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

    Great video to learn JS tricky interview questions. I felt thrill waiting for each answer of a question

  • @Michael-hj9fx
    @Michael-hj9fx 6 лет назад +1

    This was a very informative video. Thank you for creating it! I'll be sharing this with some of my programmer friends :)

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

      Where are you right now? Did you land at your first job? I am having an interview today.

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

    I really like this series! I learnt a lot from watching these. Thank you!

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

    for the one with the total arguments, we can also use a simple 'return arguments.length'

  • @gouravgirdhar9973
    @gouravgirdhar9973 6 лет назад +1

    I'm grateful for all the effort you are putting in which makes learning so much easier. Thanks for all the hardwork

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

      Thanks for watching Grourav. I am gladthat it helped!

  • @sufiyan0011able
    @sufiyan0011able 5 лет назад +1

    Thanks for making this video. Its a great help for guys like us.

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

    This video is so important and you have shared very good questions with valid answers. Thanks a lot

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

    What is your opinion on return this object instead of returning main object? Is there are any relation of this with closure? - var A = {x: function(){console.log('x'); return this;},y: function(){console.log('y'); return this;},z: function(){console.log('z'); return this;}}

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

    I am just thankful to you from heart for these videos.

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

    Your content is great and very informative.
    Keep up the good work!

  • @devolee8302
    @devolee8302 5 лет назад +2

    'Document.body.cotentEditable = "true" ' is super cool !!!

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

      Yes first time i saw contentEditable I was blown away. :)