Fizzbuzz in JavaScript Explained Simply
HTML-код
- Опубликовано: 1 окт 2024
- Fizzbuzz is one of the most famous beginner algorithms. It's also great for showing you one of the main uses of the modulus operator , % . You should definitely know how to solve this one for job interviews!
If you want to become a developer, then you need to be able to come up with solutions to problems. In this series I teach the algorithms that you'll be expected to know.
I don't think you know how the modulus operator works...
1%2 and 3%2 are both equal to 1, not 0.5 and 1.5
Yeah you are right! 3 % 2 = 1 because 2 goes into 3 once with a remainder of 1.
POV : You're watching this during middle of an interview.
Thanks for this.. I was unsure of myself but this helped a lot.. Keep up the great work.
Glad it helped!
good shitfam !
I solved it first using string concatenation instead of if-elses, but now i think this way is probably better.
Another awesome video :) well done!
Thanks Martin mate!!
Wasn't it easier just to write i % 6 === 0 for when the number is divisible with 3 and 2? But great explanation!
Yeah, I think that would also work. Thanks Marko!