Meow, Woof, Party!
Given a positive integer n, loop through every integer from 1 to n, inclusive.
For each number:
- Use
"meow"if the number is divisible by4. - Use
"woof"if the number is divisible by7. - Use
"party"if the number is divisible by both4and7. - Otherwise, use the number as a string.
Implement the function meowWoofParty and return all results in an array. Returning an array lets the playground check the values that would normally be printed.
Example
Input: n = 7
Output: ["1", "2", "3", "meow", "5", "6", "woof"]
Input: n = 8
Output: ["1", "2", "3", "meow", "5", "6", "woof", "meow"]
Constraints
1 <= n <= 10,000
Loading...
Output will appear here…

