Mock Technical Interview - Javascript Developer Junior Level

Поделиться
HTML-код
  • Опубликовано: 27 май 2024
  • A mock technical interview featuring Gavin and myself where we go through some introductions, high level conceptual technical questions, as well as four coding questions together. This style of interview is similar to something you'd see at the Junior to Intermediate level when applying for software developer or web developer positions.
    In this interview we are coding with Javascript as that is what Gavin has been studying and working with, however the structure and style should be similar for all types of technical interviews at this level.
    Thank you Gavin for braving the recording with me and allowing others to learn from us!
    Chapters:
    00:00 Introductions
    04:45 What is Javascript?
    05:30 What is React?
    07:31 What is a REST API?
    09:54 What is a Database?
    11:30 Login Process Explanation
    20:45 String Palindrome (Easy)
    33:05 Create Array Map (Easy)
    42:16 Flatten an Array (Medium)
    1:00:38 Create getElementById (Hard)
    1:32:36 Recap and Feedback
    1:38:55 Revisiting Palindrome
    1:44:28 Wrap-up
    💬 Come join us on Discord to chat with a like-minded community about tech and learning: / discord
    🏅Support the channel and content through Super Thanks, Channel Memberships, or on Patreon: / techwithnader
  • НаукаНаука

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

  • @littlem1ss
    @littlem1ss 3 месяца назад +6

    As someone who is preparing to embark on my own technical interviews for the first time, this is an incredibly helpful resource.
    Watching this mock interview is easing my anxieties and helping me overcome my strong feeling of imposter syndrome. Thank you for sharing this!

  • @mr_arroz
    @mr_arroz 7 месяцев назад +26

    For the first question: Primitive values like strings are automatically converted to objects (wrappers) when you access their properties or methods. In this case, when you call a method on a string literal, JavaScript temporarily converts the string to a String object, which is why you see [String: 'racecar']. At the end, you're comparing a string literal to a string object using ===. To make it work, you can just compare values (==), or do something like, 'this.toLowerCase()', which will act on the string literal of the string object and return true. Confusing...I know.

    • @outspan87
      @outspan87 5 месяцев назад

      or this.valueOf() to access the value

    • @skadio90
      @skadio90 5 месяцев назад

      Autoboxing 🤨

  • @TheStrategist314
    @TheStrategist314 6 месяцев назад +4

    This is probably my favorite mock. Very professional acting, knowledgeable of what he knows and doesn't but is able to express it without seeming like a bro.

  • @lewistaylor4620
    @lewistaylor4620 9 месяцев назад +7

    Code question 1: The '===' operator checks for both equality and datatype. In this case, we are comparing and object string against a string, hence the equality will always return false. The fix: use '==' operator which will just check for equality.

  • @TechWithNader
    @TechWithNader  10 месяцев назад +15

    Thanks to @zia on the Discord for looking in to the mystery of the String and this Object:
    Regarding this being an object but not a string literal, basically, when a function is executed, this is converted into an object if its not already.
    So string literal is converted into an an object which for string hello looks like
    {0: h, 1: e, 2: l, 3: l, 4: o, length: 5 }
    ECMAScript calls is string exotic object (just learned btw).
    TLDR: value of this keyword is always converted to an object.
    Conversion of this to an object: es5.github.io/#x10.4.3
    String exotic objects: 262.ecma-international.org/14.0/#sec-string-exotic-objects

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

      😇

    • @andrefig822
      @andrefig822 8 месяцев назад +4

      More simpler than that, I can just say that one is an object `String`, other is a primitive `string`. An instance of a String ""class"" is not identical to a primitive, but can be loosely equal. If you just used '==', it would work, or 'this.toString() === reversed'. A primitive is not an instance of a class, but JS automatically turns it into it with auto-boxing. That's why also "typeof String('hello')" returned primitive stringing console, it's internally "(new String('hello')).toString()". To check it in the prototype context: "typeof new String('hello')" => "object". And in the long run, that is makes confuses devs...

  • @randerins
    @randerins 10 месяцев назад +6

    These are extremely useful. Thanks a lot, Nader!
    I'd like to suggest a video that would advice on how to get recruiters' attention, to land the interview. Seems like a real struggle.

  • @user-ef8yz9fu5i
    @user-ef8yz9fu5i 10 месяцев назад +3

    I like these. Really having a good time watching and good imagining my future interview in this area

  • @antoinenijhuis450
    @antoinenijhuis450 3 месяца назад +1

    I don't see how a self-taught beginner programmer has knowledge of things such as restAPI, strict comparisons, backend processes, recursion, depth first search implementations as well as a pretty decent high level overview of the language, after only a year.
    Very impressive!

    • @Kamil-rf5qn
      @Kamil-rf5qn 2 месяца назад

      The amount of hours required to go from zero to junior level job-ready is around 1,200h. That can be done in a few months to a year depending on the amount of time you put in. I'm at 300 hours mark right now (1.5 month in) as self-taught and solving most of the problems they give here instantly as I do a lot of codewars/leetcode. Covering all the topics you mentioned is easy, you can do it in a few weeks. Being good at them is a different story. Recursion alone took me a week of daily struggles to grasp the basics of it. I'm doing The Odin Project and most of the things you mentioned is covered later on into the course as well.

  • @sereyvathanakkhorn760
    @sereyvathanakkhorn760 10 месяцев назад +3

    I never actually had a proper JavaScript interview, but your video demonstrates an accurate level of interview would be liked. It definitely nudged me into thinking more of a typical questions to why am I doing things in JavaScript, especially in the earlier stage of the interview questions about React, API, etc. The follow up coding interviews were very interesting. For example, if someone where to ask me about the MAP function, I should be doing ok, but coding it.... is another question.

  • @djjordis
    @djjordis 6 месяцев назад

    I stopped the video in each question for find the response by myself, and the tecnifiqué part i resolved the problems by myself too and then I continued with the video.
    Was very interesting!

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

    It looks like a real interview. The guy are nervous but answers are good. The interviewer keeps calm and a very kind. I had the same experience)

  • @sequoiakanies2202
    @sequoiakanies2202 12 дней назад

    Good video and great job. Super impressive for only having coded for a couple years

  • @andrewwall2730
    @andrewwall2730 4 месяца назад +3

    Great video, really helpful. Just curious why you want to create methods on the prototype instead of just using plain functions. This seems dangerous as it could collide with other libs that add methods to the prototype. Seems the trend is away from OOP to functional programming. Also in JS, 'this' always refers to an object, though strict-mode may modify that behavior but not sure.

  • @hbgl8889
    @hbgl8889 10 месяцев назад

    56:09 Gavin actually had the right idea which is to pass in the result array as an argument to flatten. On the other hand, the implementation you suggested needlessly creates temporary arrays.

    • @TechWithNader
      @TechWithNader  10 месяцев назад

      Good point! Yes, this can be done without the new array allocations but the code looks a bit messier since you need to use it in a closure or declare a separate/global function to use. If you have the code for it, it would be really helpful for others to see this alternative way since it can definitely be more space/alloc efficient 😊

  • @wallacesansanoski8185
    @wallacesansanoski8185 10 месяцев назад

    thanks to share this helpfull video. I think in the first code question we can just use String function (not String constructor) to convert to string and make strict check on value.

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

    thank you for these videos

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

    Thanks for the video😁

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

    In non-strict mode, THIS is always a reference to an object. In strict mode, it can be any value. - MDN
    So you could have also used this.toString() instead of String(this)

  • @Dext-err
    @Dext-err 8 месяцев назад

    thanks a lot Nader

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

    The problem with this was that it's mentioned that it's a object in the docs right? That's why it was an object and we all know that everything in js is a object so when we use the String constructor and pass an object it returns the string. Let me know if you find any fault here

  • @noid3571
    @noid3571 10 месяцев назад

    Palindrome question, is the solution used in the video better than iterating the string with a single for loop matching symbols from both ends of the string and breaking on the first mismatch?

    • @konan6191
      @konan6191 10 месяцев назад

      the solution utilizes functional programming which is more or less specific to prototyping in js. so from the aspect of using a prototype, yes it's
      better

    • @NoxyYT
      @NoxyYT 10 месяцев назад

      Single loop like that should be much more efficient and doesn't allocate unnecessary memory so it is better (more performant). Some could argue that 'functional' solution is more readable, but I'm not so sure about that as imperative one literally spells out how we think about palindromes and I think would read just as fast.

  • @jsagar95
    @jsagar95 5 месяцев назад

    This was too good ! (no pun intended)

  • @hmm1778
    @hmm1778 10 месяцев назад

    In the first problem we should either loosely compare "this" with reversedString (using ==) or compare this.valueOf() with reversedString

    • @KevinCogen101
      @KevinCogen101 9 месяцев назад

      We could also use this.toString() === reversedString

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

    great review friends, if possible take me to work)

  • @abdessittirharkati7603
    @abdessittirharkati7603 10 месяцев назад

    I would love to have an interview with you Nader

  • @satyajitj5388
    @satyajitj5388 10 месяцев назад

    Can the palindrome task be solved in this way? Would appreciate your feedback :)
    String.prototype.isPalindrome = function (str) {
    if (str.split("").reverse().join("").toLowerCase() === str.toLowerCase()) {
    return true;
    } else return false;
    };
    console.log(String.prototype.isPalindrome("racecar"));

    • @dualasus12
      @dualasus12 10 месяцев назад

      Yes just not as readable in some opinions but you could also get rid of the else since you return out of the if statement and even remove the brackets. However you will have to use this unless you want to call it as String.prototype.isPalindrome(myString) vs using this and calling myString.isPalindrome(). One addition note is your version also requires a check to ensure it is a string being passed in. With the "this" version it will implicitly be type string since method only accessible through String prototype chain unless you did something like String.prototype.isPalindrome.call(myArray) which would also break the "this" option but would almost have to be intentional miss use
      // Replace "this" with str and add back to function signature for your version.
      String.prototype.isPalindrome = function () {
      str = this.toLowerCase()
      if (str.split("").reverse().join("") === str) return true;
      return false;
      };
      console.log(myString.isPalindrome())
      // Your version.
      String.prototype.isPalindrome = function (str) {
      if (typeOf(str) !== "string") throw new Error(''Argument must be a string");
      str = str.toLowerCase()
      if (str.split("").reverse().join("") === str) return true;
      return false;
      };
      console.log(String.prototype.isPalindrome(myString))
      Also thank you for pointing this out I forgot to .toLowerCase in the video.

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

      They only need to do:
      String.prototype.isPalindrome = function () {
      return this.split("").reverse().join("").toLowerCase() === this.toLowerCase()
      };
      console.log("racecar".prototype.isPalindrome());

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

    I'd love having him as my interviewer... I feel sick to my stomach whenever I have live coding challenge or tech interview... I just can't think well when someone watches me :(((( I am just frozen.

  • @user-hz1hf5nt1s
    @user-hz1hf5nt1s 6 месяцев назад

    cool video)

  • @LucianoClassicalGuitar
    @LucianoClassicalGuitar 23 дня назад

    Make more please

  • @saidibra9231
    @saidibra9231 5 месяцев назад

    I think it is not a good idea to use String.prototype.isPalindrome and Array.prototype.myMap it will cause a lot of problems which is why you will never see someone using them in an interview or in a project. instead just use a normal function like: function isPalindrome, function myMap, etc

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

    Are you sure this is for a junior position? I think it might be more suitable for a junior position at a FANG corporation. Given the salary range of 60k to 100k, these types of exercises would likely be appropriate for a mid-level software engineer.

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

      agree, I don't think this is junior lvl

    • @danfrith726
      @danfrith726 9 месяцев назад

      he did mention junior/intermediate so id say a, this is more for a junior(with a year + under the belt) minimum/intermediate.

    • @Kamil-rf5qn
      @Kamil-rf5qn 2 месяца назад +1

      I'm 1.5 month into learning programming from zero and solved most of the problems in video. I doubt this is mid level.

  • @LeMatt87n
    @LeMatt87n 10 месяцев назад

    I came here to hear the English language from the point of view of a non English speaker

  • @terry_swd
    @terry_swd 6 месяцев назад

    I think it's unnecessarily confusing for a Junior Level interview to use the String.prototype.isPalidrome. Just let the guy focus on the main goal of the question which is to check for a palindrome with a simple function. :)

  • @nilfux
    @nilfux 8 месяцев назад +2

    DSA is a BS way of determining employee value. But here. Anyone over 40 usually does poorly with these because we didn't have classes to learn, we taught ourselves. Now we are senior systems designers and we find solving these stupid puzzles ridiculous. Proves next to nothing. We hired someone who smoked all the DSA, on the job they were absolute trash. Couldn't even commit things to Git, had no idea about TypeScript, had no idea about the value of cohesive patterns. Just hot garbage hire, 9 months later, they left. DSA is a red herring at best. Libraries solve most of these, like Lodash, and if not, use AI to generate a starting point and optimize it.
    These are solved here for reference. I wrote these, but only because of interviewing. Interviewing is broken. They should be asking us to build something related to the job. Not this nonsense.
    O{n} version
    const isPalindrome = str => {
    const forward = str
    const reverse = str.split('').reverse().join('')
    return forward === reverse
    }
    The interviewer will then ask you to optimize it, which means remove the memory so O(1) version using pointers.
    const isPalindromeWithPointers = str => {
    let left = 0
    let right = str.length - 1
    for (let i = 0; i < str.length; i++) {
    if (str[left] != str[right]) {
    return false
    } else {
    left = left + 1
    right = right - 1
    }
    }
    return true
    }

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

    this seem overly convoluted for a junior mock interview. Playing around with prototypes in this manner and creating things that already exist in JS ie map, flatten etc seems really odd.

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

    const array2 = [1,2,[2,4,[7,8]],[8,9]]
    Array.prototype.flatten = function(depth=1){
    let result = []
    for(let i=0;i0){
    result.push(...this[i].flattern(depth-1))
    }else{
    result.push(this[i])
    }
    }
    return result;
    }
    console.log(array2.flatten(2))
    Array.prototype.myMap = function(cb){
    let ownArray = [];
    for(let i=0;ivalue*2)
    console.log(newArray)
    Array.prototype.myFilter = function(cb){
    let ownArray = [];
    for(let i=0;ival%2==0);
    console.log(filtered)

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

    String.prototype.isPalindrome = function() {
    return Object.values(this).join("") === this.split("").reverse().join("") ? true : false;
    }

  • @MohamedFathy-jw8vo
    @MohamedFathy-jw8vo 9 месяцев назад +1

    String.prototype.isPalindrome = function () {
    if (this.split('').reverse().join('') === this.slice(0)) { return true; }
    return false;
    };

    • @yassinezaza7118
      @yassinezaza7118 6 месяцев назад +1

      String.prototype.isPalindrome=function(){
      return this.split("").reverse().join("")===this.toString()
      }