--- id: 5900f36e1000cf542c50fe80 challengeType: 5 title: 'Problem 1: Multiples of 3 and 5' --- ## Description
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below the provided parameter value number.
## Instructions
## Tests
```yml tests: - text: multiplesOf3and5(1000) should return 233168. testString: assert.strictEqual(multiplesOf3and5(1000), 233168, 'multiplesOf3and5(1000) should return 233168.'); - text: multiplesOf3and5(49) should return 543. testString: assert.strictEqual(multiplesOf3and5(49), 543, 'multiplesOf3and5(49) should return 543.'); - text: multiplesOf3and5(19564) should return 89301183. testString: assert.strictEqual(multiplesOf3and5(19564), 89301183, 'multiplesOf3and5(19564) should return 89301183.'); - text: Your function is not returning the correct result using our tests values. testString: assert.strictEqual(multiplesOf3and5(8456), 16687353, 'Your function is not returning the correct result using our tests values.'); ```
## Challenge Seed
```js function multiplesOf3and5(number) { // Good luck! return true; } multiplesOf3and5(1000); ```
## Solution
```js const multiplesOf3and5 = (number) => { var total = 0; for(var i = 0; i < number; i++) { if(i % 3 == 0 || i % 5 == 0) { total += i; } } return total; }; ```