--- id: 5a23c84252665b21eecc8040 title: Sum multiples of 3 and 5 challengeType: 5 forumTopicId: 302332 --- ## Description
The objective is to write a function that finds the sum of all positive multiples of 3 or 5 below n.
## Instructions
## Tests
```yml tests: - text: sumMults should be a function. testString: assert(typeof sumMults == 'function'); - text: sumMults(10) should return a number. testString: assert(typeof sumMults(10) == 'number'); - text: sumMults(10) should return 23. testString: assert.equal(sumMults(10), 23); - text: sumMults(100) should return 2318. testString: assert.equal(sumMults(100), 2318); - text: sumMults(1000) should return 233168. testString: assert.equal(sumMults(1000), 233168); - text: sumMults(10000) should return 23331668. testString: assert.equal(sumMults(10000), 23331668); - text: sumMults(100000) should return 2333316668. testString: assert.equal(sumMults(100000), 2333316668); ```
## Challenge Seed
```js function sumMults(n) { } ```
## Solution
```js function sumMults(n) { var sum = 0; for (var i = 1; i < n; i++) { if (i % 3 == 0 || i % 5 == 0) sum += i; } return sum; } ```