ex-FAANG Developer vs "Impossible" JavaScript Quiz

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 มี.ค. 2024
  • How well do I know JavaScript? Let's find out with this supposedly impossible JavaScript quiz!
    JavaScript Quiz: javascriptquiz.com/
    Prepping for your frontend interviews? Use code "conner" for a discount on my product FrontendExpert:
    www.frontendexpert.io/conner
    🎬 TikTok: / connerardman
    💼 LinkedIn: / connerardman
    💻 Video/Coding Gear (affiliate): www.amazon.com/shop/connerardman
    Business/brands 👉 youtube@connerardman.com
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @ThePrimeTimeagen
    @ThePrimeTimeagen 2 หลายเดือนก่อน +426

    i got them all right and got immediately hired by a FAANG company

    • @blazerowland407
      @blazerowland407 2 หลายเดือนก่อน +34

      no he didn't hes lying

    • @thumbsuckerjoe
      @thumbsuckerjoe 2 หลายเดือนก่อน

      Can confirm.

    • @brockdaniel8845
      @brockdaniel8845 2 หลายเดือนก่อน +2

      Nicee !!!

    • @Endem1cProductions
      @Endem1cProductions 2 หลายเดือนก่อน +38

      i got them all wrong and now i'm homeless

    • @frankjosephjr3722
      @frankjosephjr3722 2 หลายเดือนก่อน +1

      Why on earth does typeof return a string instead of the actual type

  • @brandonkellner2920
    @brandonkellner2920 3 หลายเดือนก่อน +104

    So [] == 0 == false if it's a number, and [] == true if it's a boolean, that makes a lot of sense. Thanks, javascript.

    • @eugeneponomarov7429
      @eugeneponomarov7429 2 หลายเดือนก่อน +5

      Empty array is evaluated the same way as empty object in js - it just substitutes the object/array with reference to heap (like 0xFFFFFFFFFFFF) which is true.
      But Number([]) is super weird and makes no sense. Well, this code makes no sense, so why the result should make sense...

    • @brandonkellner2920
      @brandonkellner2920 2 หลายเดือนก่อน

      @@eugeneponomarov7429 Interesting. I don't write javascript, so I had no idea why it would work that way.

    • @GBOAC
      @GBOAC 2 หลายเดือนก่อน +1

      @@eugeneponomarov7429because determinism should be separate from the subjective perception of something making sense or not.

  • @matts154
    @matts154 3 หลายเดือนก่อน +51

    While this quiz is a fun way to test of your knowledge of Javascript, these scenarios are why we have "use strict" and linting rules.

    • @harshvardhansankpal716
      @harshvardhansankpal716 2 หลายเดือนก่อน

      what does strict mode do ? it abolishes all these activities

  • @andreikhotko5206
    @andreikhotko5206 3 หลายเดือนก่อน +46

    I see 1 good use case for String.raw: defining a string variable containing backslashes. For example, windows filepath. String.raw`D:\path\to\file`, which is more readable than "D:\\path\\to\\file". This can be applicable to any string value containing backslashes which you don't want to escape everytime. It can be even inlined SQL script which can contain string literals (not a good idea, but anyway)

    • @wntiv
      @wntiv 3 หลายเดือนก่อน +7

      personally was thinking with regex, if you needed to use the constructor (for whatever reason), which takes the representation of the regex *as a string*, in which you would have to double-escape any special chars (e.g. \d -> "\\d"). This would not be necessary using String.raw.

    • @cameronball3998
      @cameronball3998 3 หลายเดือนก่อน +2

      exactly. i’ve used raw strings all the time for defining static regex in python code. e.g., `r’my raw
      string’`

    • @soniablanche5672
      @soniablanche5672 3 หลายเดือนก่อน

      Yep. I have a script that uses String.raw to store a Windows path in a variable.

    • @joshix833
      @joshix833 2 หลายเดือนก่อน

      Just use slashes for paths. Why would one use backslashes?

    • @cameronball3998
      @cameronball3998 2 หลายเดือนก่อน +2

      @@joshix833 windows’ path separator is the backslash; it’s necessary to use to delimit a path on windows

  • @benl9878
    @benl9878 2 หลายเดือนก่อน +4

    love when people bring up they are a former faang employee. i don't bring up that I use to bag groceries at kroger.

    • @ConnerArdman
      @ConnerArdman  2 หลายเดือนก่อน +2

      Much like crossfitters, we are contractually obligated to bring it up at all possible moments

  • @bobcoleman2920
    @bobcoleman2920 3 หลายเดือนก่อน +2

    I recently used a version of String.raw in C# where instead you use the @ symbol before the string (string myString = @"my string contains "quotes" and stuff"), and this was for adding a SQL Server connection string to my app, so instead of using \ before the " to consider it part of the string itself, you use the raw value of the string which is everything contained within the outermost quotes

  • @BeccaYetiammo
    @BeccaYetiammo 2 หลายเดือนก่อน +4

    10:18 I haven’t heard of String.raw in JS but there is a similar feature in Dart. One use case for them is declaring regular expression string literals. You don’t have to deal with escaping certain characters etc.

  • @Q_20
    @Q_20 2 หลายเดือนก่อน +1

    String.raw is useful with creating regular expression dynamically

  • @acirinelli
    @acirinelli 2 หลายเดือนก่อน

    Floating point arithmetic caused me so many problems until I learned about it. Switched to all integers and convert to decimals.

  • @user-hr7wl8xr7o
    @user-hr7wl8xr7o 2 หลายเดือนก่อน

    String.raw is pretty useful when you work with windows-like path in Node.js

  • @thekwoka4707
    @thekwoka4707 หลายเดือนก่อน

    Starts off wacky. Since in strict mode the first one would throw an error, not evaluate to anything. And modules are automatically strict mode.

  • @schwidola3549
    @schwidola3549 3 หลายเดือนก่อน +1

    Looks like useful knowledge to debug weird code that some co-worker might have written, if they didn’t know those pitfalls 😅

  • @yega3k
    @yega3k 3 หลายเดือนก่อน +19

    This is why I hate dynamic languages (a little 😅)

    • @foo0815
      @foo0815 3 หลายเดือนก่อน +13

      Dynamic languages are ok, automatic type conversion isn't.

    • @stefanalecu9532
      @stefanalecu9532 3 หลายเดือนก่อน +4

      Are you really projecting your hate towards JS onto other dynamic languages? Python doesn't have this skill issue, for instance

    • @yega3k
      @yega3k 3 หลายเดือนก่อน +1

      It’s an issue that can only happen in a dynamic language because it has to do some kind of type “guessing” since your types are not explicitly defined. I’m learning Elixir right now and I also don’t like the “ambiguity” of type sometimes - like having a list of mixed types. So it’s not just JS (although JS could be the worst offender).
      That said, I still use JS and Python and as mentioned I’m learning Elixir - another dynamic language so no need to get defensive 😉

    • @yega3k
      @yega3k 3 หลายเดือนก่อน +1

      I take back my previous reply. Automatic type conversion does make a big difference.

    • @AbbyChau
      @AbbyChau 3 หลายเดือนก่อน +1

      just blame JS. the rules are so messy.

  • @RayBellis
    @RayBellis 2 หลายเดือนก่อน

    9/10, and only because I was fooled by the correct answer for `typeof NaN` not having string quotes around it so I had ruled it out.

  • @borjinator
    @borjinator 3 หลายเดือนก่อน +3

    I surpringly got all correct except number cast of empty array in question 7

    • @ConnerArdman
      @ConnerArdman  3 หลายเดือนก่อน

      Nice! 👏👏👏

  • @davidlightfoot3217
    @davidlightfoot3217 2 หลายเดือนก่อน

    When coding in Python, at least, I would use raw strings for regex

  • @Fishpizza1212
    @Fishpizza1212 2 หลายเดือนก่อน +1

    For the floating point precision problem: Does JavaScript give you standard library tools to deal with errors in floats?
    I'm just wondering because in other languages, like Rust or C, you can just cast 0.1 and 0.2 as f32 (Rust) or float (C) which then is equal to 0.3, so 0.1 + 0.2 == 0.3 is true when cast as f32.
    Rust:
    println!("{}", 0.1 as f32 + 0.2 as f32 == 0.3 as f32);
    Even other interpreted languages like Python give you the 'decimal' module as part of the standard library, which lets you handle it like so:
    Python:
    from decimal import Decimal
    print(Decimal('0.1') + Decimal('0.2') == Decimal('0.3'))
    which returns true.
    The Decimal module handles decimal numbers as exactly their mathematical equivalent (up to a certain cutoff, which can be manually extended).

    • @scezar8880
      @scezar8880 2 หลายเดือนก่อน

      the rust thing is really weird but surprisingly true
      though I don't think it's comparable to the decimal lib in python
      it's just that JS floats are 64 bit by default, and you're manually casting it to 32 bits which have less precision, or something

    • @guillaumebrunerie
      @guillaumebrunerie 2 หลายเดือนก่อน +1

      It’s just by accident that with f32 you get 0.1 + 0.2 == 0.3. Try 0.1 + 0.6 == 0.7 for instance and you will get false in Rust while you get true in Javascript.
      Decimal numbers are not comparable at all to floats, for instance 1 / 3 is not a decimal number, which makes them pretty useless for many applications.

    • @thekwoka4707
      @thekwoka4707 หลายเดือนก่อน

      There isn't really a way to solve them in any language. It just happens to work out in some ways.
      You can just do integer math to avoid it.

  • @ExpensivePizza
    @ExpensivePizza 2 หลายเดือนก่อน +1

    It's actually insane that we ended up on the timeline where JavaScript exists.

  • @kazmi401
    @kazmi401 3 หลายเดือนก่อน +5

    Delete it Before interviewers come here.

  • @harshvardhansankpal716
    @harshvardhansankpal716 2 หลายเดือนก่อน +1

    plz tell me theses are the stress buster questions which u and ur interviewer will laugh on after him asking abt, promises, event loops and other stuff.

  • @soham9119
    @soham9119 3 หลายเดือนก่อน

    I would like to hear your thoughts on Devin AI and it's impact on job market

  • @CitizenKen1
    @CitizenKen1 2 หลายเดือนก่อน +1

    Dude looks like Peewee Herman and the guy who played Polkadot man from The Suicide Squad.

  • @domesticcadiz
    @domesticcadiz 2 หลายเดือนก่อน

    What is funny is i only knew the one you got wrong. I got a lot to learn 😂

  • @ivangechev4243
    @ivangechev4243 3 หลายเดือนก่อน +10

    This is quiz is filled with questions only related to javascript behaviors that are weird and most likely if you know what you do won't ever see.

    • @ConnerArdman
      @ConnerArdman  3 หลายเดือนก่อน +10

      Yeah that’s kind of the point haha. And while you’ll never see these things specifically, I actually think knowing them is a decent proxy for having a deep understanding of the language.

  • @chiragbansal7786
    @chiragbansal7786 2 หลายเดือนก่อน +3

    Only got 7/10 right, time to quit being a JS dev and start farming or something

  • @herok3447
    @herok3447 2 หลายเดือนก่อน +3

    Thank god, we dont send people into space using this language

  • @deadlyecho
    @deadlyecho 2 หลายเดือนก่อน +1

    I got 8/10, the first one got me, I didn't even know that '0' means octal 😂 and what the fuck is string raw 😂😂

  • @ryostyles9904
    @ryostyles9904 3 หลายเดือนก่อน +5

    So i failed to answer all the ones which you answered right, but answered the one you answered wrong 😢

    • @ConnerArdman
      @ConnerArdman  3 หลายเดือนก่อน +7

      If we combine our powers, we’d be unstoppable…

    • @WeaselOnaStick
      @WeaselOnaStick 2 หลายเดือนก่อน +1

      ​@@ConnerArdmanOr fail all 100%

  • @spartanboosts
    @spartanboosts 2 หลายเดือนก่อน

    Cool vid!

  • @iamplk
    @iamplk 2 หลายเดือนก่อน +2

    why he looks like AI character. all time i was analysing his movements lol

    • @ConnerArdman
      @ConnerArdman  2 หลายเดือนก่อน +2

      Too much time working for the Zuccbot, so I’m still part lizard robot for now…

    • @iamplk
      @iamplk 2 หลายเดือนก่อน +1

      @@ConnerArdman are you for real a robot?

  • @RayBellis
    @RayBellis 2 หลายเดือนก่อน

    NB: the questions are not always the same.

  • @abdelrhmanmohamed4754
    @abdelrhmanmohamed4754 3 หลายเดือนก่อน

    hi can you make a video how much javascript is enough before react js , because someine tell me i should can build in big app with js , is that true

    • @DarthVader11912
      @DarthVader11912 3 หลายเดือนก่อน

      If you want to learn JavaScript and react do the Odin project it's amazing and very detailed.

    • @ConnerArdman
      @ConnerArdman  3 หลายเดือนก่อน +1

      There is no single threshold, it’s pretty subjective. You should be pretty comfortable with JavaScript though imo.

    • @yt-sh
      @yt-sh 3 หลายเดือนก่อน

      th-cam.com/video/m55PTVUrlnA/w-d-xo.html
      just start building at first, then you'll dive deeper and deeper

  • @bdafeesh
    @bdafeesh 2 หลายเดือนก่อน

    Jezuz, so much JS ready to ruin your day. An empty array is truthy?? Implicit string-> number conversion...but only sometimes where it's number -> string conversion instead!? Implicit bool -> number conversion?! My mind is melting...

  • @jason13gaming
    @jason13gaming 2 หลายเดือนก่อน +1

    Re-title the video to “10 reasons to avoid JavaScript at all costs”

  • @Everythingwithharneet
    @Everythingwithharneet 3 หลายเดือนก่อน +1

    Just had a doubt that are these test and things actually useful in the code like when I work with JavaScript I don't use all this stuff if something is there that I don't understand I learn it on the go is it the right approach or like I need to reevaluate?

    • @ConnerArdman
      @ConnerArdman  3 หลายเดือนก่อน +6

      If you used something in this video regularly, you would probably be doing something wrong haha. I think understanding how these things work can be a good proxy for understanding of how the language works, but this is just a fun quiz. It's not meant to be the most practical knowledge ever.

    • @RayBellis
      @RayBellis 2 หลายเดือนก่อน

      @@ConnerArdman yes, this. If you don't explicitly ensure that all of your variables are of the type you expect, or if you use operators on types for which they are not intended so that implicit coercion happens, then you deserve all you get. The coercion rules *are* specified and deterministic, but no-one should be using them.

  • @suhaib_nisar
    @suhaib_nisar 3 หลายเดือนก่อน

    ❤ from Kashmir

  • @nathanbourquin6554
    @nathanbourquin6554 2 หลายเดือนก่อน

    Leading zero becomes an octal number because… 0 looks like O?

  • @MrHenryG123
    @MrHenryG123 2 หลายเดือนก่อน

    Why on earth does typeof return a string instead of the actual type

    • @ConnerArdman
      @ConnerArdman  2 หลายเดือนก่อน +2

      Because it has to return a value like any other function, operator, etc. Types aren’t values. For example, you can’t return just the number type. You need a value to describe what type it is, and a string like “number” is a reasonable way to do that.

    • @MrHenryG123
      @MrHenryG123 2 หลายเดือนก่อน

      @@ConnerArdmanI suppose that is reasonable in JavaScript since there are not that many actual types (i.e. you can't define your own so you probably don't care about the robustness. Not to say it isn't robust, it just seems a bit unintuitive at first)

    • @RayBellis
      @RayBellis 2 หลายเดือนก่อน

      @@ConnerArdman you actually can return types e.g. `Number` from a function. There must be some other reason that JS doesn't do that.
      Try e.g. const n = () => Number ; n()(3)

    • @ConnerArdman
      @ConnerArdman  2 หลายเดือนก่อน +1

      That is not returning a type. Number is a constructor function for creating Number objects. I guess you could make an argument for returning these wrapper object constructors, but I think that would be _really_ messy.

    • @RayBellis
      @RayBellis 2 หลายเดือนก่อน

      @@ConnerArdman hmm, true, but constructor functions are _almost_ an analog for types, especially since the ES5 class syntax.

  • @AbdurRahim-eu3zr
    @AbdurRahim-eu3zr 3 หลายเดือนก่อน

    More videos like this

  • @MyWatermelonz
    @MyWatermelonz 2 หลายเดือนก่อน +1

    Lol, people actually defending the dumpster fire that is JS

  • @user-ml5em9eo2e
    @user-ml5em9eo2e 2 หลายเดือนก่อน +5

    My god JavaScript is a horrible language

  • @kxhu
    @kxhu 2 หลายเดือนก่อน

    me no no wanna

  • @SnazzieTV
    @SnazzieTV 2 หลายเดือนก่อน +1

    These questions are stupid, no real world scenario would you have these.

  • @zFede_Rico
    @zFede_Rico 2 หลายเดือนก่อน +2

    i learned something today:
    Do NOT use javascript.

  • @MrJester831
    @MrJester831 3 หลายเดือนก่อน +1

    This video makes JS look really bad

    • @foo0815
      @foo0815 3 หลายเดือนก่อน +4

      Because it is.

  • @matthewchampagne9621
    @matthewchampagne9621 2 หลายเดือนก่อน +1

    This language has to be a joke

  • @myanrueller91
    @myanrueller91 2 หลายเดือนก่อน

    “JavaScript default sort converts to strings first.” And this is why people don’t like JavaScript.

    • @RayBellis
      @RayBellis 2 หลายเดือนก่อน

      Rubbish. Perl's default sort functor is also a string sorter. A sort function has to have _some_ default functor so why should it be a numerical sort instead of a lexical sort?

  • @foo0815
    @foo0815 3 หลายเดือนก่อน

    Javascript is just the most stupid programming language ever.

  • @p1p1sasa
    @p1p1sasa 2 หลายเดือนก่อน

    I HATE JAVASCRIPT!!!!!

  • @jvfr-
    @jvfr- 2 หลายเดือนก่อน

    people would k1ll somebody because of a programming language lol as long as javascript keeps paying my bills it can keep returning these weird values

  • @MasterSamus
    @MasterSamus 2 หลายเดือนก่อน

    All this proves is that JavaScript is a shitty language made in a weekend. And all standards and tooling for it follow the same philosophy of rushed and esoteric for the dumbest reasons.

  • @jonragnarsson
    @jonragnarsson 2 หลายเดือนก่อน

    JavaScript? More like JesuScript, beause you will be constantly saying Jesus Fucking Christ, What The Fuck is going on in the language?

  • @jvfr-
    @jvfr- 2 หลายเดือนก่อน

    lol those are useless, stupid ass questions. this ain't never happening in a real world project. I hate when interviewers ask those kind of questions, It just shows that I shouldn't have even bothered to participate in the process

  • @PatrickMageez
    @PatrickMageez 2 หลายเดือนก่อน +1

    This is why I avoid using JavaScript. It's a very nonsensical language

  • @Samarichitane
    @Samarichitane 2 หลายเดือนก่อน

    What a clown language. I hate it.

  • @DaDescriptor
    @DaDescriptor 2 หลายเดือนก่อน +1

    JavaScript sucks

  • @jonsmith7718
    @jonsmith7718 2 หลายเดือนก่อน

    i gotHelloTwitter
    world correct ...lol and i didn't see the answers before hand either ...