I’ve not managed to check this site out yet, but it’s an interesting idea. This could come in handy for those doing the JavaScript Programming for the Web course on the May Learning initiative.
Write a function called fizzbuzz that accepts a single argument n. fizzbuzz should return “Fizz” if n is a multiple of 3, “Buzz” if n is a multiple of 5, “FizzBuzz” if n is a multiple of both 3 and 5, and n if n is a multiple of neither 3 nor 5.
My answer (which gives the right results but apparently doesn’t meet the criteria):
The page displays the following at the right of the input area showing green background for a pass and red background for a fail (but incorrectly shows the third item in red.
Program must be valid JavaScript.
Program must fit within a tweet (max 140 characters).
Program must correctly implement a fizzbuzz function.
It seems that the site is incapable of recogising that the code used performs the task as specified. Presumably the site tests for a specific answer rather than testing if the entered code actually does what is required. There are plenty of longer alternatives to this code that would still allow it to fit in the 140 character maximum so presumably the site authors are expecting one of those longer answers
fizzbuzz should return “Fizz” if n is a multiple of 3, “Buzz” if n is a multiple of 5, “FizzBuzz” if n is a multiple of both 3 and 5, and n if n is a multiple of neither 3 nor 5.
Your solution fails because it returns ‘Fizzbuzz’ rather than ‘FizzBuzz’.