Must Know Javascript Interview Questions

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

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

  • @max_iddqd
    @max_iddqd Год назад +83

    The main difference between regular and arrow functions is a context (this): regular function changes context (this = parent object), arrow function don't (this stays the same). This can be very useful.

  • @wotizit
    @wotizit 2 года назад +39

    THIS:
    The handling of this is also different in arrow functions compared to regular functions.
    In short, with arrow functions there are no binding of this.
    In regular functions the this keyword represented the object that called the function, which could be the window, the document, a button or whatever.
    With arrow functions the this keyword always represents the object that defined the arrow function.

  • @Brandon-tz5pn
    @Brandon-tz5pn 2 года назад +20

    04:39 I cant believe I've been coding for this long and never noticed this. I guess I automatically write my return statements the right way without thinking about it.

  • @peanutcelery
    @peanutcelery 2 года назад +28

    One big one for arrow functions is the this reference.

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

      The biggest one I think. If ask a candidate to name the key difference between arrow and normal functions, I expect this answer

  • @jastheskater
    @jastheskater 4 месяца назад +2

    Thank you, I have worked as mainly a backend engineer over the past 4 years and have an interview for a full stack position. I haven't touched much JavaScript in a while these days and these concise videos helped me refresh my memory on these huge differences in JavaScript compared to strongly typed languages (i.e. Java, C#). Thanks again!

    • @catherinelijs
      @catherinelijs  4 месяца назад

      I’m really glad you found it useful!

  • @incarnateTheGreat
    @incarnateTheGreat 10 месяцев назад +2

    Thanks for these.
    I'd say the gotcha function call with the line break might be disregarded nowadays with Prettier and autoformatters, but still good to mention.

  • @KAZVorpal
    @KAZVorpal 5 месяцев назад +3

    THE MAIN difference for arrow functions is that they don't have the synonym "this".
    That should be mentioned by anyone facing that question.

  • @cr7forever7877
    @cr7forever7877 Год назад +14

    Today is my very first interview day and this video already helped me a lot. Thank you! I just subscribed and I'll keep track of your videos

    • @catherinelijs
      @catherinelijs  Год назад +2

      Thank you much and good luck on your interviews!

    • @kardi3107
      @kardi3107 Год назад +1

      How did the interview go?

    • @cr7forever7877
      @cr7forever7877 Год назад +5

      @@kardi3107 that one was not that good but I got hired in the second interview 😅. Been working over 3 months

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

      ​@@cr7forever7877I'm almost done my JavaScript course. How do I prepare for interview questions?

  • @swtlynn93
    @swtlynn93 Год назад +5

    Could you do an example on what happens during a live coding assessment or a whiteboard session? I know this is part of the technical interview and I have NO clue what the heck happens in them.

    • @dayronalfaro9461
      @dayronalfaro9461 Год назад +2

      Be confident, dont panic, even if you cant code try to think an solve the problem loud, break the problem in pieces and then try to code that with pseudocode or code

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

    Amazing explanation Thank you sooo much

    • @catherinelijs
      @catherinelijs  11 месяцев назад

      Really glad you liked it. I have a few more videos that you may like as well!

  • @sergiomendoza6833
    @sergiomendoza6833 2 года назад +3

    I am addicted more please

  • @marcelorl8730
    @marcelorl8730 2 года назад +3

    you forgot to mention about the this scope which is the actual key difference between arrow functions and regular functions

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

      and the this keyword!

    • @marshall-brown
      @marshall-brown 2 года назад +1

      I believe the word you mean is "context" not scope

  • @Adam-qe8yo
    @Adam-qe8yo 2 года назад +1

    Woo hoo! I knew most of the answers. Except the last questions #4.

  • @NicolePimenta
    @NicolePimenta Год назад +1

    Perfect video !thankss

  • @min0234
    @min0234 2 года назад +1

    This really helps, thanks for the video!

  • @Rantalytics
    @Rantalytics 2 года назад +1

    awesome, thank you Catherine, this was awesome

  • @geesunjang557
    @geesunjang557 2 года назад +2

    This is so helpful Catherine. Thanks for the video! :)

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

      You’re welcome! Glad you found it useful

  • @vycos-zen
    @vycos-zen Год назад

    at 2:30 it is actually not correct i think. this function for example
    const test = () => {return "hi"};
    and run it in your browser console. than run test(); it works. the reason why CODE SEMPLE 3 does not work because the Car class has to be defined. like
    class Car {constructor(){
    this.color = () => "hi"
    }}
    than you can instantiate it with
    const test = new Test();
    and can be called by
    test.greet();
    so i would look into clarifying that part, at around 2:30. And by the way, great video over all, sorry for the nit picking. Good content and using it for refreshing for an interview. thank you.

  • @EnzoAuditore
    @EnzoAuditore Год назад +1

    Thank you for this.

  • @js9549
    @js9549 Год назад +1

    You’re awesome thank you for sharing your experience 😊

  • @jadehendricks2368
    @jadehendricks2368 9 месяцев назад +3

    One thing though is that promises are taken to the micro task queue which takes precedence over the callstack. While SetTimeouts etc do not.

    • @oleksandrbarabanov6684
      @oleksandrbarabanov6684 2 месяца назад

      Important correction: micro task takes precedence over macro-task queue, NOT the callstack. Basically priorities are always as follows:
      #1 callstack
      #2 micro tasks queue (resolved promises)
      #3 macro tasks queue (like events callbacks, timeouts etc)

  • @FM-bf7yq
    @FM-bf7yq 2 года назад +3

    This is gem❤️

  • @carloanimationTV
    @carloanimationTV Год назад +1

    very informative I also noticed your nice hair

  • @bekurmolla6477
    @bekurmolla6477 2 года назад +1

    Great video. It was very helpful 🙌🏽

  • @MrBeastFan_Gyak
    @MrBeastFan_Gyak 2 года назад +1

    great video , thank you !!

  • @lastspoil5547
    @lastspoil5547 10 месяцев назад +1

    The two videos you have on JavaScript interview questions are enough to study or do we still need to study leetcode? Also, will we be asked React questions? ❓

    • @catherinelijs
      @catherinelijs  9 месяцев назад +1

      You'll still need to brush up on leetcode and React, with way more competition for jobs now, hiring managers are asking detailed questions.

  • @rashim
    @rashim 7 месяцев назад

    4:50 It will throw syntax error, and won't return undefined.
    Unexpected token '}'

  • @ahmedfarhan4353
    @ahmedfarhan4353 2 года назад +1

    Does front end die ?

  • @darz_k.
    @darz_k. 2 года назад +2

    Thank you!

  • @dayronalfaro9461
    @dayronalfaro9461 Год назад +2

    Once you say "I Should set a counter" I stop listening the video an start couting the word function an cheeck the counter to see if it's wrong jejejejeej

  • @EugenePetrov-l6l
    @EugenePetrov-l6l Год назад

    The example with object returning is mindfulness test)

  • @LionelMessy-n5k
    @LionelMessy-n5k Год назад +1

    Great video!

  • @BirhanNega
    @BirhanNega Год назад +1

    Thank you

  • @PektraNao
    @PektraNao День назад

    im definitely not passing an interview wow!

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

    This is ok but I got asked all these in my junior position screening interview, what am I gunna get in my second and more technical interview?

    • @notsmoothie
      @notsmoothie 2 года назад +1

      What did u get asked? 😅

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

    la penúltima pregunta, acerca de la diferencia entre foo1() y foo2() ¿se debe al salto de línea según entendí?

    • @alisonroa5823
      @alisonroa5823 2 года назад +2

      Si, JavaScript autoañade un ; al final del return porque no hay nada que continúe en la misma linea, en este caso está en la siguiente línea entonces no retorna nada y deja de ejecutar la función.
      En el ejemplo es:
      Return
      {
      }.
      Las llaves con indicaciones están en la línea de abajo y JS solo leyó el return.

  • @shooting4star2023
    @shooting4star2023 6 месяцев назад +2

    The foo1 and foo2 question at 4:21 is seriously a screw-up in JavaScript.

  • @InDiAnAjOnEs0002
    @InDiAnAjOnEs0002 4 месяца назад +1

    I love your videos

    • @catherinelijs
      @catherinelijs  3 месяца назад

      Thank you!!!

    • @InDiAnAjOnEs0002
      @InDiAnAjOnEs0002 3 месяца назад

      @@catherinelijs make more of these, maybe create a playlist..all the best..love from India

  • @arpitjha2843
    @arpitjha2843 2 года назад +2

    Awesome 😎

  • @Arabian_Abomination
    @Arabian_Abomination 2 года назад +1

    Thanks

  • @eliascarrion1053
    @eliascarrion1053 2 года назад +2

    Thanks!!!

  • @11Najim11
    @11Najim11 Год назад

    2:34 is wrong. You can use them as object constructors, just put braces around them

  • @umarmamatov2985
    @umarmamatov2985 Год назад +1

    array1.map(function(x) => {
    return x*2
    })😅

  • @TienNguyen-2909
    @TienNguyen-2909 2 года назад

    I come from Asia and I thought you look like Asian, your video is very helpful and your voice very easy to hear. Thank you so much!!!

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

    She really put that counter up there, lol.

  • @emilz0r
    @emilz0r 7 месяцев назад +1

    Did you really use jQuery for the promise example?🤭

  • @20mim20
    @20mim20 Год назад +1

    @3:49 did you say the f word ? I dont blame you lol

  • @rebeccatom2188
    @rebeccatom2188 4 месяца назад

    Idk if anyone ever told you this but you have a midwest accent, especially when you say javascript

    • @catherinelijs
      @catherinelijs  3 месяца назад

      lol first time I heard that! So I can move to Minnesota and nobody would suspect a thing? 🤔

  • @petergriff7624
    @petergriff7624 2 года назад +5

    I tried this :
    function run(){
    console.log(1);
    setTimeout(function(){console.log(2),1000})
    setTimeout(function(){console.log(3),0})
    console.log(4);
    }
    run();
    output is:
    1
    4
    2
    3
    so 2 won't be console logged last
    But thanks for this i didnt know about this order of preference .

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

    Don't understand... I need to learn more 😩

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

    How can i contact you ma'am ?

  • @Mrandersonk1
    @Mrandersonk1 2 месяца назад +1

    thanksCat ()

  • @yasingunaydiin
    @yasingunaydiin Месяц назад +1

    İ am so cooked

  • @Trinig03
    @Trinig03 Год назад +1

    Great video!