[Problem]
Write a function that takes an integer and returns an array [A, B, C], where A is the number of multiples of 3 (but not 5) below the given integer, B is the number of multiples of 5 (but not 3) below the given integer and C is the number of multiples of 3 and 5 below the given integer.
For example, solution(20) should return [5, 2, 1]1
2
3function solution(number){
}
[Algorithms]
- Declare variables for the number of multiples below the given integer(3, 5, 15)
- Add counts for the number of multiples below the given integer using ‘for’ statement
- get an array of the variables
[Solution]
1 | function solution(number){ |
[Best Practice]
1 | function solution(n) { |