You are currently viewing Answering tricky JavaScript interview questions

Answering tricky JavaScript interview questions



We all work in our respective silos when writing JavaScript, be it a framework or library. After a few years working as a Front-end dev, I looked at a list of “JS interview” questions and realized that I couldn’t answer many of them (at least not well). So I set out on a long, somewhat lonesome journey of JS discovery, and am pleased to share my findings with you, in the form of a talk.

Regardless of how you feel about getting asked random questions meant to trick you up in an interview (you should be appalled), my talk will cover some basic JS subtleties, and hopefully fill in some knowledge gaps w/r/t:
– Hoisting and variable scope
– Expressions v. statements
– Undeclared v. undefined v. null
– Equality comparisons
– How to properly walk out if an interviewer asks you to do fizz buzz

This talk was given at Nodevember 2016 by Russell Anderson.

Checkout the Nodevember channel for more great talks: https://www.youtube.com/channel/UC7z0nOE8ITfrGnXJgNzYaEQ

This talk is under the creative commons license. freeCodeCamp is not associated with this talk. We’re just excited to bring more exposure to to it!

Learn to code for free and get a developer job: https://www.freecodecamp.org

Read hundreds of articles on programming: https://medium.freecodecamp.org

And subscribe for new videos on technology every day: https://youtube.com/subscription_center?add_user=freecodecamp

source

This Post Has 31 Comments

  1. Very good presentation, I learn a lot. Maybe sameone have a link for this list of questions which was on the 28:46?

  2. Simone Icardi

    Nice to know that I'm not the only one to find this kind of questions often, not so relevant to spot a good dev.

  3. D

    Why do really religious people always bring up that they are religious whenever they give a talk on a completely unrelated topic?

  4. The definition of hoisting is completely inaccurate here. Nothing is "declared / moved to the top" as many sources claim.

  5. Vikas KM

    Nice talk.. 👍👍 learning JavaScript and loving it

  6. Yorumcu Turk

    No need to know who exactly you are, whats your religion, your parents…etc.
    When I start reading books about programming languages, the authors wrote about their life, what they drinking when they writing the book, about wheather…etc. First 100 pages of the book are empty talk. Just teach! Stop wasting the our time. We boring! We are stop watching or reading and can't learn anything.

  7. Yorumcu Turk

    I'm Muslim. I been developing software and web application since 15 years……………………………………….

  8. Marc Droz

    why people here are so triggered about this individual literary taking 3 seconds out of a 35 minute interesting talk to share his world-view. …3 seconds! …didn't even made it a big deal! lul

  9. utubewatcher806

    32:21 nailed it! if you're getting an interview that is completely based on knowing terms and techniques of the tools, run to the nearest exit. Usually a sign that the interview panel doesn't have a grasp on delivery and is focused on tools.

  10. In lieu of random technical questions, I would love the opportunity to go into detail in any one of my projects—some of which are open source. While discussing the code, you'll get technical know-how right alongside how I came up with solutions to situations. Let's not interview; let's code!

  11. Pawan Deore

    I know 80% answers does that mean I am 7/10 in JavaScript.🤔

  12. Hasan Said

    These interview questions are only going to get worst and harder because of the amount of devs available now a days smfh.

  13. correction:
    let foo=null
    typeof foo // return "object" as string 😀

  14. Frank Johnson

    I'm sure this is a cool video, but can the thumbnail be updated to match the person speaking?

  15. web boss

    00:00 Introduction
    00:19 About Russell Anderson
    01:57 Inspiration for the talk
    02:22 Brad Frost's responses to HTML5 Boilerplate frontend developer interview questions
    03:54 Are interview questions a good idea?
    04:48 Explain event delegation
    05:59 Describe event bubbling
    06:30 How event bubbling and delegation works in practice
    08:05 What's the difference between "target" and "currentTarget"
    08:35 Explain why function foo(){}() doesn't works as an IIFE
    09:16 Explain the difference between writing a function as a statement and an expression
    12:14 Why in general is a good idea to leave the global scope of a website as-is and never touch it?
    13:17 Explain "hoisting"
    18:13 What do we do with the knowledge of hoisting?
    19:22 What is the difference between a variable that is null, undefined or undeclared?
    26:36 What is the difference between == and === ?
    28:25 You are hired!
    28:52 Closing remarks
    30:32 Questions and Answers

  16. joey alfaro

    The way it was explained to me no one wants to train the code monkeys. Start up just wants to exploit you. Stepp leaning curve to figure out computer is stupid just freezes because it doesn't understand. Their is guy that figured it out Fredrik Christenson hed on here he will help you understand whole picture.

  17. my name

    "so you wanna be a chef here ? tell me how to write a cookbook then …"
    "im a chef not a writer i can cook if you want"
    "ok i dont think youre right for us "
    thats how dumb coding interviews are

  18. Nitesh Tak

    You question for hoisting your answer is incorrect , kindly check it again , it will not throw any error

  19. David Turner

    He has a developer job and can't do a simple fizzbuzz? What am I doing with my life?!

  20. IsayanBros

    The title is deceptive. Turns out the most basic javascript questions are considered “tricky” by this guy. I started watching this video with completely different expectations as of what “tricky” constitutes.

  21. Jibin Babu

    Let and const are also hoisted. But they are in temporal dead zone

  22. Wintur윈터

    him saying "um" is really distracting. I have adhd. 😭

Leave a Reply