FizzBuzz is a mental arithmetic game that got turned into a popular interview question. But what if we took the principle and created 8 different c...
For further actions, you may consider blocking this person and/or reporting abuse
Done!
It's still undergoing refactoring and extra credit exercises, but I'm kinda busy (I got exams!). It might be done in 24 hours.
When you have tidied up (and fixed a naming bug, hint hint
wordmap
andwordMap
) then let me know!After an initial look though it looks good ❤, but I won't test properly until you tell me to!
P.s. my instructions might not have been clear enough but there should be no "decrease" button, the "next" button coupled with the checkbox should dictate direction. I will check that the instructions don't cause confusion there.
You can consider it done! After a lot of testing and stuff, it seems bug free. Test it out and tell me if there's any problems.
About my attempt
Challenge 1: Was not very hard, just had to reimplement division, which was pretty easy
Challenge 2: Still pretty easy. Just had to add some event listeners. This was made even more easy by the fact that my
fizzbuzz
function only checked a single number.Challenge 3: Just had to add a few lines
Challenge 4: This was easy at first, but would ultimately be the biggest problem and I had to rewrite it.
Challenge 5: That was literally what I was doing. I was just logging to the console outside my
fizzbuzz
function. Just needed to change a few lines.Challenge 6: Easy again, because my
fizzbuzz
function just checked one number, and I just had to change the numbers in the recursion I was doing earlierChallenge 7: Easy, but this was where I made 99% of my silly mistakes (I was trying to reverse recursion, until I realized I need to pass in the minimum). This part took the most time.
Challenge 8: This was pretty easy, because I'm used to manipulating objects in this manner.
What I learned:
PS: These challenges are awesome, would love it if you make more! I might even make a challenge myself! (I did once but no one answered. I guess it was too hard)
Hmm the decrease button came up a accidentally because of my initial confusion, and I decided to keep it. Consider it a bonus.
I have added the following paragraph to section 7 to clarify this part as it was not well written:
"So you should now have 3 buttons, "next", "complete the run" and "reset" plus a checkbox with the label "Reverse order". If "Reverse Order" is checked then pressing "Next" will decrease the number by one and pressing "complete the run" will count downwards from the current number. "
My CSS only solution. Work from 1 to infinity (chrome and edge only)
codepen.io/t_afif/pen/dyWpree
Will probably optimize later to cover more cases.
I knew I could count on you to use CSS to solve JS problems!
Looking at it it is more difficult than I thought to do with CSS.
I thought a
:before
and:after
combo was going to be the trick but didn't actually think about how to fix positioning like that!Really interesting solution! ❤
I hope the instruction are clear and this is a fun Sunday challenge for people.
My answer will come out next week / the best answers for both beginner and pro.
Oh and if you are one of those people who really like to show off - you can code golf your answer if you want (but still in JavaScript please)!
I look forward to seeing what people submit (if anyone does that is!)!
oh and please ensure it is a runnable sandbox fiddle / pen etc. so people can play with your entry!
Mistake – You mention a direction in the table in step 5, but there's no decrease button!
Ah now I get you, I changed the order of challenges and forgot about that part. I think I have now accounted for that, great spot!
Thanks for pointing it out! ❤
Wow, great challenge! This inspired me to make a small extra challenge:
Classic fizzbuzz, but:
"use strict"
eval
or such (obviously)let
/var
%
) and noMath
Objectif
/else
const
==
,===
,!=
,!==
)return
statements{}
😈It's solvable, have fun :D
That sounds horrific! If I get chance I will see if I can put a solution together but as the England vs Italy match is on at the moment it will have to wait! 😋
Check out FizzBuzz-Everything, a community driven GitHub repo with FizzBuzz written in a whole lotta languages!
Thats really cool, I will include it in the part 2 / follow up piece if I remember. Thanks for sharing!
Looks good, I will have a run through it soon!