FizzBuzz with TypeScript

This commit is contained in:
Oliver Davies 2022-09-24 00:49:23 +01:00
commit 4e2e0d6f0c
7 changed files with 2236 additions and 0 deletions

View file

@ -0,0 +1,15 @@
module.exports = (input: number): string => {
if (input % 3 == 0 && input % 5 == 0) {
return "FizzBuzz";
}
if (input % 3 == 0) {
return "Fizz";
}
if (input % 5 == 0) {
return "Buzz";
}
return input.toString();
};