I Have Only One Javascript Question

Sdílet
Vložit
  • čas přidán 25. 08. 2024

Komentáře • 24

  • @DaveGrayTeachesCode
    @DaveGrayTeachesCode  Před 3 lety +1

    A job interview with only one question? It happened, and it could happen to you! In this tutorial, we take a look at the question that was given and break down the logic for the answer. If you're just starting with Javascript, I suggest working through my full 8 hour video course on Javascript before this tutorial: czcams.com/video/EfAl9bwzVZk/video.html

  • @WanKy182
    @WanKy182 Před 3 lety +1

    I start watching video without any idea what is Pascal's Triangle after reading some docs here my solution:
    const factorial = (num) => (num === 0 ? 1 : num * factorial(num - 1));
    const calc = (row, term) => factorial(row) / (factorial(term) * factorial(row - term));
    const createTriangle = (num) => {
    const arr = [];
    for (let i = 0; i < num; i++) {
    let arrI = [];
    for (let j = 0; j

  • @marcod.643
    @marcod.643 Před 3 lety +2

    I'll repeat myself, but you should have 1MIllion subscribers.
    Your content is always great and so valuable.
    I can't get over why your numbers are still so low.
    Thanks a lot for your amazing job and you can bet that I'll make all I can to let others know about your wonderful channel.

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  Před 3 lety

      Thanks again for the kind words. 🙏 Slow and steady growth with no viral video yet. That could change though! Thanks for the support! 💯🚀

  • @johnmcaulay4348
    @johnmcaulay4348 Před 2 lety +1

    Bro you are actually the best Javascript / coding content creator on CZcams right now...keep up the awesome work!

  • @Enginor
    @Enginor Před rokem

    learned so much Dave keep it up

  • @rangabharath4253
    @rangabharath4253 Před 3 lety +1

    Awesome as always 👍😀

  • @nivsmalfunctionn
    @nivsmalfunctionn Před rokem

    Another awesome video to make my brain cells do some work :) And I have a question: is there any reason to explicitly parse our array values to integers if we put there only numbers in the first place? Or is it a precaution just in case of anything?

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  Před rokem

      Long time since I looked at this video, but in general, it is always good to know the type of data you are working with. That's the idea behind TypeScript 🚀

  • @ahmad-murery
    @ahmad-murery Před 3 lety

    Hello Dave,
    This is the third time trying to submit my comment but it's got deleted for some reasons. so here I am again,
    After reading a brief description about Pascal's Triangle I noticed two things:
    1- In row 0 (the topmost row), there is a unique nonzero entry 1, so maybe we can initiate stackArray with [ [1] ] instead of an empty array (while condition must be adjusted)
    2- Treating blank entries as 0 (when summing the two cells above), we can remove the if (!x || x === i - 1) and use the Nullish coalescing operator to replace blank cell values with 0, so all value will be calculated instead of hardcoding these
    For CSS,
    the square borders to the left/right sides of the triangle look thinner, if we add top/left margins of -1px to the squares we should be able to collapse the borders of consecutive squares
    I forked the code and applied those changes for easier code checking github.com/ahmad-511/one_question_interview
    I also added 'odd' class to squares with odd values so it shows the recursion pattern more easily,
    Thanks Dave,

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  Před 3 lety +1

      Hi Ahmad, it is strange that your previous comments did not show up. I always welcome your comments and did receive their notifications, but as you note, when I went to CZcams to respond, the comments were not there. I'm glad I can respond to this one! 😀
      I like your alternative suggestions. As always, great feedback my friend! 🙏🚀

    • @ahmad-murery
      @ahmad-murery Před 3 lety

      ​@@DaveGrayTeachesCode That's really strange 🥴, but not as strange as my ISP is,
      I'm happy that I finally made it on the third time,
      Thanks for the great work my friend🏆

  • @1conscience0dimension

    So helpful

  • @JPNSynster
    @JPNSynster Před 3 lety

    Forgot to say thanks for this video too ! How did you go about learning yourself as you mentioned you didn't have a CS degree either when you started in another video.

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  Před 3 lety +2

      You're welcome! I plan to do a video on my background at some point, but I owned my own company and decided to "fix it myself" out of necessity. It got me started writing more than HTML and I discovered I really liked solving problems with code. Thanks for asking!

    • @JPNSynster
      @JPNSynster Před 3 lety

      @@DaveGrayTeachesCode That's fantastic !! Thanks for getting back to me, always good to hear about your background, and I love how you teach !

  • @RcToysUa
    @RcToysUa Před 2 lety

    super!

  • @pascuLaurentiu
    @pascuLaurentiu Před 3 lety

    best teacher !

  • @eleah2665
    @eleah2665 Před 3 lety

    So how long would you give the interviewee to solve this?

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  Před 3 lety +1

      That's a great question 💯, and depending on who is conducting the interview, the time limit could vary greatly. I'll go on record as saying I am not in favor of a one question interview or even algorithm questions that do not allow you to use all resources that you would normally have available on the job to craft a solution. I Google topics and refer to MDN all the time in a normal day of work. Einstein said "Never memorize what you can look up." Given this interview was only one question, I hope they allowed the dev 30 minutes. If they wanted to create a pressure environment, they might have said 15. I'm just guessing at the time limit though. Very subjective overall.