4 Ways to Solve FizzBuzz | Daily Programmer | Episode 0

Поділитися
Вставка
  • Опубліковано 7 лис 2024

КОМЕНТАРІ • 27

  • @habibi750
    @habibi750 Рік тому +2

    I really like how some of the comments from the twitch chat were looking out for the beginners like myself. You guys rule.

  • @habibi750
    @habibi750 Рік тому +3

    You are killing it with these new segments.

  • @beastlyagar
    @beastlyagar Рік тому +1

    I love how straightforward this video was

  • @irawsum
    @irawsum Рік тому +2

    Thanks for showing several different solutions and showing the code optimization process!

  • @themudreco
    @themudreco Рік тому +1

    Woooo, finally I can be here for the start of a series, lets goo.

  • @ArrowCodes
    @ArrowCodes Рік тому +6

    How frequent will the videos be in this series? Really looking forward to it.

  • @rakilzzz
    @rakilzzz Рік тому +1

    I like all these new series. Please continue :)

  • @StefanRows
    @StefanRows Рік тому

    Amazing. Keep these coming!

  • @CoffeeNomad_
    @CoffeeNomad_ Рік тому

    Love these videos! And also how you are testing the waters on YT. Looking forward to the future change! lol

  • @mahmoudabdelsattar8860
    @mahmoudabdelsattar8860 Рік тому

    Man make more if this
    I Fill in love with js
    I'm golang guy

  • @onlinetechnology5015
    @onlinetechnology5015 Рік тому

    why you stop making these js algorithms videos these are awesome please continue this series and new persons should learn everything from you

    • @CodingGarden
      @CodingGarden  Рік тому

      I hope to make more soon. Definitely checkout the code katas series for similar problem solving videos: ua-cam.com/play/PLM_i0obccy3sZGzZdpEtxPcR1iPIV0taQ.html

    • @onlinetechnology5015
      @onlinetechnology5015 Рік тому

      @@CodingGarden yeah i saw but i love this way new series and this is awesome i love your solving style and everyone should understand what are you doing i m waiting for videos

  • @Xaoticex
    @Xaoticex Рік тому +1

    So is this not in twitch

    • @CodingGarden
      @CodingGarden  Рік тому +5

      This was recorded live on twitch!

    • @nouchance
      @nouchance Рік тому +1

      @@CodingGarden Thank you BOSS

  • @MichaelMossmanNZ
    @MichaelMossmanNZ 2 місяці тому

    Wow! Only 21 comments in 12 months. Okay, so I wanted to watch this video just for fun, but I don't know JS well. I do code in other languages, and one of the things that I always try to do is keep my code readable. By that I mean: if ANYONE were to sit there & read my code, no matter what their skill level, then they should be able to follow along. The reason I am commenting here is that I was easily able to follow this beginners' JS example, UNTIL we got to the Array.with part ... looking at that code just baffles me, and although I think I understand it, why American2050 would we want or need to complicate things by doing it this way? Also, if the function STARTS with return, then why is there ANOTHER return at the END of the function?

    • @CodingGarden
      @CodingGarden  2 місяці тому +1

      The last solution is a more functional approach. The callback function gets called for every value up to n. The return value of the function will be the resulting value at that index in the new array.
      The function passed to Array.from is essentially a map function. You can read more about it here: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#mapfn
      It is very similar to array map: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map

  • @leslie7922
    @leslie7922 Рік тому +1

    Cool

  • @Trazynn
    @Trazynn Рік тому +1

    Can you do one on styled React components? I suck at it.

  • @asagiai4965
    @asagiai4965 Рік тому

    We're still missing one more way/method.
    Your explanation is okay, though.
    FizzBuzz is old
    I'm doing hotcake pancake

    • @MichaelMossmanNZ
      @MichaelMossmanNZ 2 місяці тому

      FizzBuzz might be old to YOU!

    • @asagiai4965
      @asagiai4965 2 місяці тому

      @MichaelMossmanNZ I think technically speaking, FizzBuzz is old for most programmers.
      Hotcake Pancake is technically the same thing.
      It is still easy, but just a different approach.

    • @MichaelMossmanNZ
      @MichaelMossmanNZ 2 місяці тому +1

      Thank you for your reply. I will check out Hotcake Pancake too =)

    • @asagiai4965
      @asagiai4965 2 місяці тому +1

      @MichaelMossmanNZ ok have fun. Idk if you can find it, though, because idk where our prof gets that.
      Though I can provide some help. If I remember how the challenge goes.

  • @sabashavidze4990
    @sabashavidze4990 Рік тому

    const TRUE = x => y => x;
    const FALSE = x => y => y;
    const range = (start, stop) =>
    Array.from({length: stop - start },(_,i) => i + start);
    const isDivisible = dividend => divisor =>
    [TRUE, ...Array(divisor - 1).fill(FALSE)][dividend % divisor];
    const fizzBuzz = N => range(0,N).map(num => {
    const isDivisibleBy = isDivisible(num);
    const isDivisibleBy3 = isDivisibleBy(3);
    const isDivisibleBy5 = isDivisibleBy(5);
    return isDivisibleBy3(isDivisibleBy5('FIZZ BUZZ')('FIZZ'))(isDivisibleBy5('BUZZ')(num));
    });
    const answers = fizzBuzz(100);
    console.log(answers);
    One more way to solve