Are You Smarter Than Me? LinkedIn JavaScript Quiz Interview Questions

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

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

  • @WebDevSimplified
    @WebDevSimplified  3 года назад +31

    The first 1000 people to use the link will get a free trial of Skillshare Premium Membership: skl.sh/webdevsimplified12201

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

      Oakey

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

      Now way I am smarter than you. You are a walking wikipedia

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

      One less available! Thanks a lot buddy, the javascript section is insane!! Defintly an happy christmas studying 🤣🤣😍🤑

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

      Thanks a lot for this. I enjoy this video very much. Normally you're so prepared in your videos and xplain things in elegant confidence. now I get to see your hard thinking mimics (which was a pleasant :D) and then managed the top 5%. Despite all u seem so humble.

  • @agilkerimov
    @agilkerimov 3 года назад +194

    when you add an element into an array with an index greater than the length of the array, it adds empty elements before this. So when you execute a[100]=1, the array's length becomes 101

    • @Malvitima0
      @Malvitima0 3 года назад +20

      That's so fuck-up

    • @codevev
      @codevev 3 года назад +3

      @@Malvitima0 I so agree

    • @stevenedwards9262
      @stevenedwards9262 3 года назад +6

      Correct - it fills in all the elements in-between with "undefined" and will return 101 because of 0-indexing. This is definitely one of the ones WDE got wrong, lol

    • @justintaddei
      @justintaddei 3 года назад +12

      @@Malvitima0 There's a very good reason for that. Imagine if the length in the example actually was 4. If you tried to loop over an array, `for (let i=0; i

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

      @Malvitima0 Arrays on not-so-high level languages (like C) are continuous strips of memory, which has an implicit order (from lowest memory address number to highest memory address number). Higher level languages (like JS) are not obliged but they do use similar concepts for their lists/arrays, which is a group of objects in an ordered, indexed manner. If you think about it, if you wanted the result to be 4, you would much rather be expected to use maps. So, if you assign the 100th element of the "memory strip", it is logical that this "strip" must also contains the 99th, 98th, 97th ... elements. Hope it helps!

  • @sergten
    @sergten 3 года назад +13

    The array length is 101, it always picks the highest one and returns undefined for the uninitialized indices:
    > let a = [1, 2, 3]
    undefined
    > a[100]=100
    100
    > a.length
    101
    > a[88]
    undefined

  • @IkraamDev
    @IkraamDev 3 года назад +311

    This is a perfect test to TEST how fast you can Google!

    • @adarshkotali
      @adarshkotali 3 года назад +8

      true😂

    • @javascript2409
      @javascript2409 3 года назад +10

      I run code and see what is answer ( fewquestion )

    • @njpromethium
      @njpromethium 3 года назад +5

      @@javascript2409 that's exactly what you're not supposed to do...

    • @xxxxdddddss
      @xxxxdddddss 3 года назад +34

      @@njpromethium atleast he will learn something this way because this stupid test wont show you where youve made a mistake

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

      @@javascript2409 That's a nice idea. Never thought about it though.

  • @PortEXE
    @PortEXE 3 года назад +76

    Awesome video! The answer to the first one is "immediately". There was no HTTP request in the code. I think you may have overthought that one and took into account the way that the JavaScript is actually loaded into the interpreter via the browser.

    • @WebDevSimplified
      @WebDevSimplified  3 года назад +21

      I really did. That one really tripped me up. Luckily the rest of the test was much more straightforward.

    • @josephcagle
      @josephcagle 3 года назад +3

      I think they were hoping to trip up people who might think that the querySelector() sends an HTTP request. Kinda weird and ambiguous IMO, though

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

      @@josephcagle if that code would be in the head and executed in the head, that querySelector call would return null or an error, not sure since I learned my lesson not to query the DOM before it is loaded.

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

    q1 - Immediately
    q4 is 101. Arrays are linear data structures. Which means data is arranged sequentially. So if there is an item at position 100, then index 0-99 must exist
    q12 - 1

  • @williamcraigz
    @williamcraigz 3 года назад +48

    Q:12's correct answer is 1. It is about closures. When a variable of a function does not exist, it will look for it at its outer lexical environment. In other words, variables wont be looked at the outer place where the function was invoked, but where it was declared. Using 'var' or 'let' will have no difference here, the result will be the same.

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

      that's correct but for the sake of completeness, if the second keyword var was omitted, v's value would have been updated and the result would be 2. using var creates an internally scope variable v in function f2. var or let would have made no difference.

    • @らんちょ-e5d
      @らんちょ-e5d 2 года назад

      @@Shivey73 i dont think it will. var is function scoped in f2 so it will stay there. f1 doesn't have var v so it will look outside ( in this case the global scope). so the answer is 1

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

      @@らんちょ-e5d maybe my explanation was not clear enough. If in f2 you state v=2 instead of var v=2, the global var which was 1 would be updated to 2 and the answer would become 2.

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

      For those who come later and still don't understand: just compile it. You'll see what they say is true. Don't be like me, who had to question this.

  • @batchrocketproject4720
    @batchrocketproject4720 3 года назад +11

    Hi Kyle, I love your videos, and you're definitely smarter than me!. I rarely comment but feel a correction is in order as it's fundamental:
    Q12 (on var and v=1, v=2). The var inside f2 is not the same as the global var! (it would be only if var was absent). Scope is defined by the block so declaring (with var, or let for that matter) v inside function f2, makes it invisible outside of that function. The declaration inside f2 does not alter the global value of V. The reference to V in f1 can only see the globally-declared V and so the answer is 1 not 2. (I probably haven't explained it as well as you could but the results never lie, try it!).
    Thanks for your efforts and keep them up!

  • @jburggraf
    @jburggraf 3 года назад +52

    I took this test back in the spring and didn't get in the percentile needed to pass. I have used javascript on and off for years, but kind of just learned what I needed to know in order to complete whatever task I was working on. Last month I saw Kyle's javascript simplified course and decided to give it a shot. I took the linked in quiz again after completing the course and got top a 5% score. This is not any kind of paid endorsement :) but it is definitely a recommendation to consider the course if you need to strengthen your javascript skills.

    • @WebDevSimplified
      @WebDevSimplified  3 года назад +13

      That is awesome Jim! I am so glad that the course was able to teach you everything you needed to know in order to ace this quiz. I also hope it taught you what you need in order to build any project you can think of.

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

    In question 12 it will log 1. Since during compilation, the value if v inside f1 will reference the variable in either its outer or local lexical scopes. v2 has been declared inside a different lexical scope, thus it doesn't re-declare var in the global scope. In other words, the v variable declared in the outer scope becomes a closure of f1 anonymous function, and is going to carry this "backpack" wherever it gets called.

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

    Number 1 would run the code outside of setTimeout first even if you set 0ms as the argument, because it places the code inside the setTimeout function at the bottom of the execution stack. I liked this video, it shows that even people who know a lot don't know everything.

  • @ibtsamnoman2415
    @ibtsamnoman2415 3 года назад +38

    10:25 It would have redefined global var if we didn't use var keyword with it
    As var is scoped to function not global, f1 will log the global var v with value 1

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

      That s also what I was thinking

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

      @@NachoDLF Yes it would be the same result.

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

      This one actually a little bit tricky, we knew that var's scope could be confusing but in this case it's definitely 1 because the global var

    • @devingray1761
      @devingray1761 3 года назад +3

      Exactly. Var can be hoisted but not outside of block scope.

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

      @@lurkinginthedark6498 "var" is function scoped

  • @hendrikhausen1058
    @hendrikhausen1058 3 года назад +3

    It's great how relaxed you are in your videos. Also, amazing that you get straight to the point without talking about nonsense for minutes. Keep up the good work!

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

    Q12)
    var v = 1;
    var f1 = function() {
    console.log(v);
    };
    var f2 = function() {
    var v = 2;
    f1();
    };
    f2();
    When the code is executed, the following happens:
    The variable v is declared in the global scope and assigned the value 1.
    The function f1 is defined, which logs the value of v to the console. Since v is not defined locally within f1, it references the global variable v.
    The function f2 is defined, which declares a new local variable v and assigns it the value 2. This local variable v shadows the global variable v within the scope of f2.
    Inside f2, the function f1 is invoked.
    When f1 is executed, it tries to log the value of v. Since v is not defined locally within f1, it looks for the variable in the outer scope, which is the global scope. Therefore, it accesses the value of the global variable v, which is 1.
    Therefore, the code will print 1 to the console. NOT 2.

  • @codingwithkenny6492
    @codingwithkenny6492 3 года назад +3

    You're an amazing teacher Kyle! Your videos are concise, straightforward, and fairly easy to understand even for a beginner like me. I'm only 14, but I'm trying to make the most of my quarantine so that's why I started coding since last year. Watching your videos helps me a lot when I get stuck on a project!

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

      keep doing. If you learn JS at 14, the time you will be 16 or 18, I am sure you would have built you own startup. Here, 36, that still is reasoning about those question. Of course I got other software language

  • @らんちょ-e5d
    @らんちょ-e5d 2 года назад +1

    Q1. it will show immediately since it is loaded directly on call stack. the setTimeout is a macrotask so it will execute after call stack is free

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

    void is for a function that returns no value. If you use return, it does not return a value - no errors, just no value is returned. It is basically a precautionary thing or a thing that you'd do for stuff that returns a value that you don't want returned.

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

    I gave this test yesterday and got 5% but never thought you will give this test. Happy to see you there :)

  • @DThompsonDev
    @DThompsonDev 3 года назад +31

    Love this! I did that quiz and got a top 5% of all the people that took this test! Very excited and curious to see what you get Kyle!

    • @sankaranarayanan7847
      @sankaranarayanan7847 3 года назад +3

      Congratulations

    • @paujoan401
      @paujoan401 3 года назад +3

      also got 5%, are we gettin lied or what?

    • @mantinez1
      @mantinez1 3 года назад +3

      @@paujoan401 mine says top 5% too haha, it's pretty sus, plus the total is like 750k people

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

      @@paujoan401 I got top 5% also. I was actually shocked as I was unsure about many of my answers.

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

      ​@@mantinez1 YOU GET 5% and YOU GET 5%! lol It is based off of the number of people that have already taken the quiz. Honestly, it is a cool thing to do over coffee though.

  • @noumanmalik960
    @noumanmalik960 3 года назад +5

    The most intense video I watched on RUclips. Congratulations Kyle!

  • @andriiauziak1178
    @andriiauziak1178 3 года назад +3

    Kyle, thank you for this video.
    And in 13th question there are two correct answers: discountPrice = function(price){...} without 'var' will also create function just fine. Looks like a mistake in this quiz.

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

      This is true, and also true for assigning any variable without a variable keyword, but it will assign it to the global object and can overwrite global properties, like Window properties if the naming isn’t careful or secure. You can, however, do the same thing inside curly braces and protect the global scope. So, for example { discount = function(price) { return price * 0.85; }}. But obviously you would also have to use the function within the same block scope too, then. Though strangely when I try this in devtools console, I can still call the function after closing the braces and hitting enter, and it’s also not on the window object, unlike if you were to do it without the outside braces…

  • @Jason-mx8dl
    @Jason-mx8dl 3 года назад +19

    First question is ‘immediately’ - the callback queue won’t run until the stack is empty.

  • @manny8156
    @manny8156 3 года назад +199

    The array length was 101

    • @noumanmalik960
      @noumanmalik960 3 года назад +38

      actually that made me feel better that even Kyle can make mistakes lol

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

      Was about to point that out XD

    • @ilverin.matriam
      @ilverin.matriam 3 года назад +4

      Glad to know I wasn't the only one thinking this.

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

      I was thinking the same, for the array length to be 4 the element at index 100 should be just after the third element, not possible.

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

      sparse arrays**

  • @broccool2300
    @broccool2300 3 года назад +6

    I failed the JS test even though I use it daily and passed the C# and I hardly know C# and almost never use it. IMO those are some tricky questions that you will almost never run into and if you do you can google your way to the right solution to get the job done. Also, it is best not to try so hard to remember everything and develop a mind that can figure out how to solve problems instead of remembering everything someone else taught you.

  • @jumaelahmed9995
    @jumaelahmed9995 3 года назад +3

    Man! you're the best CSS dev & the smartest one.

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

    4. Answer is 101
    12. Answer is 1 because v === 2 only inside f2 it would have overwrite the "ouside" v without the var keyword
    13. I agree with you, but answer number 2 could work as well (it is not a good practice to add variable to the gloabal object but this is not a crime either)
    14. I'm not sure what the problem is expect the result is very predictable

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

    Happy to see I'm not the only one that was a bit stumped by the LinkedIn quiz. Much prefer real coding assessments like CodeSignal etc.

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

    I think the answer to the first question should be immediately. Timeout functions and other promise calls and what not will not be executed till the global thread of execution is done. Then only javascript will look for stuff in the micro task queue and callback queue. In this case setTimeout will always run last. Even if you have 1000 console.logs after that.
    Watch Javascript hardparts by will sentance. (Frontend masters)

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

    Hey man, I just wanted to thank you for making all of these awesome videos. I (computer science grad) started watching your css/html videos and have been following all your projects ever since. Keep up the great work!

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

    Great stuff, I really enjoy and appreciate your content. Regarding Question 12 about what value will function f1 will log to console. I know reason of that but I got it wrong anyway as I rushed through when I tried to solve it along with you when I was watching video.
    The trick here is that var is function scoped, however it is also as important that scope of function is declared based on where function is declared, not where it is executed and here we have both function declared in global scope. For example if we have:
    var i = 1;
    function f1() {
    f2();
    var i = 2;
    function f2() {
    console.log(i)
    }
    }
    f1();
    then we would get three scopes:
    - global scope ( var i =1, function f1)
    - function f1 scope (var i =2, function f2)
    - function f2 scope ()
    Now when execution of f2 happen, it check if there is variable declaration for i , if not it would look up in closest/nearest outerscope that is f1 scope. Here js parser would find variable declaration for i with value of 2 assigned so it would use that value in scope of function 2. I believe it is similiar but not exactly same as closure concept, that would worked differently, but correct me if I am wrong

  • @strawhatrick
    @strawhatrick 3 года назад +3

    I took this test about a month ago and got top15%. You're good 😅

  • @sthefanocarvalho2823
    @sthefanocarvalho2823 3 года назад +6

    5% here too!
    But I answered some questions differently haha
    It'd be great if we could know which questions we got wrong :/
    Thanks for the great content as usual :)
    You are an inspiration

  • @Wreighn
    @Wreighn 3 года назад +3

    I got all of them right except 11. That was the first time I've heard of void in js.

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

    In question 12 the answer is 1 because of the second assignment of v is actually a new initial variable of the function 'f2', which means that it doesn't change the global 'v' variable..

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

    Question 13, at least in the console you don't have to use let/const/var to create a function, but it will be a property of the window object. This doesn't work in ES6 modules though.

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

    howdy. great work. the function would have logged 1.
    f1 closed over v global v, not the f2 local v. since f1 does not accept v as an input, f1 logs unchanged global v 1.
    var is still function scoped. let and const are block scoped, in addition, so they will need to be redeclared in loops, if statements, etc.
    if f2 said v = 2, f1 would log 2.
    this is an example of why shadowing can get confusing. you lose track of what scope the variable is in.

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

      +1 for mentioning "shadowing" you must be old skool JS ✌

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

    I was thinking Q12 @ 10:00 would print 1.
    f1 prints the global variable v,
    f2 defines a new variable v, which is function scope, and this is different from the v logged in the f1 function.

  • @iancuvlad7368
    @iancuvlad7368 3 года назад +14

    3:54 1 is PHP, 2 is Haskell, 3 is Javascript

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

    Actually really enjoyed this video, do another 👌

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

    I was delighted when you got the a[100] question wrong, not in a malicious way mind you, but because it makes you seem more human, lol. I was shouting the entire time "it just fills the in-between values with 'undefined'!", lol

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

    In my opinion In number 12 since you are using var you are creating a new local variable inside the scope of the function f2 and you are not assining the number 2 to the v present in the global scope (window)... if the keyword var wasn't there it would have been 2... hope to help someone with that... by the way thanks for sharing :D

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

    Question number 12 will return you a value of 1 because f1 forms a closure with the global variables v=1 so when you invoke f1 inside f2 it doesn't really care about the local v=2 unless you pass it as an argument.

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

    Question 12 the correct answer is 1 because the f1 function looks for the first global variable v outside it's scope, which is var v = 1. Var v in the second function becomes a new variable trapped within the scope of the second function.

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

      If the var in the f2 function was not used then and just v =2 was used it would have reassigned the global variable to 2.

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

    Learned a lot. Please do take these type of assessments for Front-End as these will help newer devs like us to evolve. Cheers!

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

    I've tried some of these linked in tests. They seem to focus on very specific and not often used details / behaviours of the language. In my opinion, knowing those is not what makes you a skilled developer. But that's my opinion.

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

    I took this test last month and got top 5%. Damn! I am good!!😎

  • @observer-0_0
    @observer-0_0 3 года назад

    thanks men I really enjoyed this quiz with you hope you do it again and again !! I like it bro

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

    thanks for this kyle you are great

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

    At Q4 is 101 not 4. It actually sets the array length to 101 and keeps any unset value to undefined and with a for...of it goes through all 101 elements, but with forEach or for...in uses only those 4 values (even if they are set to undefined later on). Actually I don't believe those values will be undefined but some other weird empty value (like the value is deleted) and you have to use a.hasOwnProperty(index) to check if there is anything.
    var a = [, 2];
    a.hasOwnProperty(0) == false;
    a.hasOwnProperty(1) == true;
    a.length == 2;
    At Q13 the second option doesn't create a new function on the global scope (window) and then can be accessed via window.discountPrice? Anyway your choice is correct

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

    var v = 1
    var f1 = function(){
    console.log(v)
    }
    var f2 = function() {
    var v = 2
    f1()
    };
    f2()
    it prints 1 because of scope, in funct 2 your declaring a new varaible inside its scope not reasigning and f1 doesnt know of a declared variables inside f2. like if you did v = 2 instead of using var then your taking the variable it has access to and modifying it

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

    Please do more videos like this

  • @SirXtC
    @SirXtC 3 года назад +79

    oh gosh I got top 3% and I still don't know how to make a simple todo list xd
    -edit : I'm actually not kidding, I did get 3% but I'm still not able to make apps without following tutorials :/...

    • @aammssaamm
      @aammssaamm 3 года назад +19

      cause it's a totally useless app. Do something which makes sense to yourself.

    • @TheCodingOdyssey
      @TheCodingOdyssey 3 года назад +3

      ha ha you crack me up lol

    • @kervensjasmin1508
      @kervensjasmin1508 3 года назад +14

      Most apps are crud apps. Just write down some key points and practice doing it blind without a tutorial. Getting stuck is a part of the process. I believe you can do it!

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

      Rust POGU

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

      @@kervensjasmin1508 I thought I was just being overly reductive when I had that thought but it turns out I wasn't the only one lol.

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

    More videos like this one please!

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

    Keep these coming Kyle

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

    dude the correct way is ( ) => ({ }) or ( ) => { return { }; } but you're on the top 5% congrats

  • @minnh2094
    @minnh2094 3 года назад +7

    Holy shit I was exactly waiting for this one!!

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

    Im a beginner and this was helpful to me. I struggle with knowing how much I actually know. I got most right as well.

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

    void is for IIFEs. I'm no expert, but basically it just means you don't want anything returned. There is another way to do it I believe if you wrap it in () so you don't have to use the keyword.

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

    I didn't skip your video, Very interesting video

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

    Wow what an awesome helpful video! Thanks for posting. The suspense had me biting my nails lol

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

    the total length is 101. But if the property(or key) of the array is a string, it doesn't affect its length.

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

    This was very informative thanks glad to hear your thoughts on the test

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

    That was fun! very basic, I wish JavaScriptSkillzQuiz could be a hashtag online.😊
    I learned something new from question 8; get methods must have went over my head
    in the spaghettis curriculum of TS/JS but sure looks very sugary! Makes the class paradigm worth using
    more honestly.

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

    I have already cleared linkedin javascript assesment test because i have been coding javascript since last 20 years, but i am not smarter most youtubes devs to showcase what I know so far.

  • @joelbarbosa10
    @joelbarbosa10 3 года назад +40

    So I think you got 3 wrong....Question 1 - I think you overthinking a little much and the answer is immediately. Question 4 is definitely 101. Question 12 is 1 because closures.

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

      What’s wrong on 3?

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

      @@patterntrader690 when f1 is called inside f2, since f1 is declared in the global scope it logs v which is in that scope itself so it will consider it as 1

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

      @@brijspy can you please give some links to read about this, not closures but this specific subject, I'm very confused.

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

      var is function-scoped so the declaration in f2 doesn't even come into play

    • @vijaynavale3919
      @vijaynavale3919 3 года назад +3

      It's simple buddy var v is functional scoped in f2() so it is not related to global var v
      There is no need of closures in here.

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

    I was top 15% in about 2M people that have presently taken the test , pretty impressive after learning java-
    script for some weeks

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

    10:28 "var" is function scoped!!!

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

    that array length better to throw a index error ,and I guess the value V would be 1 because it’s rededined in f2, not a assignment.

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

    var a = [1,2,3];
    a[100] = 100
    console.log(a.length); => gives 101
    here rest of element is undefinded

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

    thank you man after I watch this video and took the same test and successes with the top 15% . ohhhh yea

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

    Sorry to say but i caught you wrong in question 5 and 12
    Answer to 5 is 101.... I don't know the exact explanation but when we do a[100]='shs' the it just go from 3 to 99 and assign them with default value. And thus the length now is 101
    Answer to 12 is 1 because whenever or wherever f1 is called it takes the value of v from its lexical environment as it already had formed a closure with its lexical environment.
    So anytime f1 is called it always refer to var v=1 no matters if you are defining var v=2 just above it.

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

    Q4 is actually 101. i tested in the console. every spot from 3 - 100 is just undefined.

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

    Awesome, interesting ❤️ , waiting for next upload as this.

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

    we need more, i mean a lot

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

    I have to learn a lot... I was in top 15% of 824k
    Your video pointed out my mistakes...

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

    Thanks. I really like your videos, I learned a lot from you.

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

    This guy has THE VOICE!

  • @mehdi-vl5nn
    @mehdi-vl5nn 2 года назад

    10:58 it does in global scop if can't find it

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

    number 4 question answer (101)

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

    On question 12 you made a mistake for sure. Because the second-time v variable is declared inside of the function as var v =2 which means it is different variable, it is not referencing the previous v variable to reassign the value of the previous v variable you have to reference it like v = 2; without var keyword.

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

    I already have that batch on js,css, and python

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

    for question 12 I got 1.

    • @Jason-mx8dl
      @Jason-mx8dl 3 года назад

      That’s right. When the console.log looks for ‘v’ within f1 and doesn’t find anything, it looks one level outside the execution context, not one level down the scope chain. One level outside of the f1 context is the global context where v = 1.

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

    Thanks Kyle for giving some wrong answers on purpose just to make us feel better

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

      I wish I did it on purpose. There were a few questions I seriously didn't know

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

    var supports functional scope, but not the block scope. For question 12 the answer was 1.

  • @football-is-divine
    @football-is-divine 3 года назад

    I became top 3% in JavaScript exam in LinkedIn

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

    I don't like test like that. because it's not presented skill u have (especially for working)
    sure the test will reflect about your knowledge and fundamental. but still
    in the end of work, i use google and stackoverflow a lot.
    the needed skill is
    - 'solving the problem', how to convert solution into algorithm then convert into code.
    - troubleshot when result error / unexpected. why? find which part is wrong, is algorithm? or code?
    of-course knowladge and fundamentel need atlast to make your code not become spaghetti.
    imo test like those (in linkedin) not filtering right candidate.
    for u guys, better make lot project for portfolio.

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

    Hey! You had the same tricky question as me on my last interview last week.
    var a=1;
    function foo() {
    console.log(a)
    }
    function foo2() {
    var a=2;
    foo();
    }
    foo2();
    I answered 2 and followed the same logic like you but the answer is 1.
    This is because function foo is using a global variable a. If they as you just to console.log a inside foo2, it will print 1, but in this case you're executing foo.

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

      Yeh. I never use var so my logic was faulty in that one :(

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

      Yes you right. if the function foo() was declare with a param like foo(a) then it would return 2

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

    var a = ['dog', 'cat', 'hen'];
    a[100] = 'fox';
    console.log(a.length);
    the answer is 101

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

    void is the return type of a function if it does not return anyting isn't it?

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

    Var is function scoped my dude. You were printing the global v which was 1.

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

    I'm pretty happy as I managed a 12/15.

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

    great video !

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

      I was thinking about 1 on Q12 the one with var v=1 , I 've just run the code and is apparently 1 lol I've nailed one :)) luckily seen a tutorial today that was just explaining let/var behave in a function. Explanation is that the 'console.log' is the F1 function and the nearest declaration is in the global scope which is 1.

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

    in question 12 in will print 1 because f1 functoin will get called

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

      because var v redefined after f1 and not passed to f1.

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

    do them all dude. fun fun fun. gonna do em too.

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

    var is function scoped so "var v = 2" does not redefine the global v because you are declaring it inside a function

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

    that was best ever, thanks

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

    You should try taking the React test - it's bloody confusing!

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

    Want more of such videos for HTML, CSS

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

    Please do it for React as well

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

    WDS could you please put a new video on ES2017 and what feature love about that. Why I'm asking this is around 94% of websites and engines are compatible with ES2017 standard and very few people fairly explained about. As you're my best JS teacher I love to hear your talks about ES2017 feature.