1.8 KiB
1.8 KiB
id, localeTitle, challengeType, title
id | localeTitle | challengeType | title |
---|---|---|---|
5 | 5900f36e1000cf542c50fe80 | 5 | Problem 1: Multiples of 3 and 5 |
Description
number
valor del parámetro proporcionado.
Instructions
Tests
tests:
- text: <code>multiplesOf3and5(1000)</code> debe devolver 233168.
testString: 'assert.strictEqual(multiplesOf3and5(1000), 233168, "<code>multiplesOf3and5(1000)</code> should return 233168.");'
- text: <code>multiplesOf3and5(49)</code> debe devolver 543.
testString: 'assert.strictEqual(multiplesOf3and5(49), 543, "<code>multiplesOf3and5(49)</code> should return 543.");'
- text: <code>multiplesOf3and5(19564)</code> debe devolver 89301183.
testString: 'assert.strictEqual(multiplesOf3and5(19564), 89301183, "<code>multiplesOf3and5(19564)</code> should return 89301183.");'
- text: Su función no está devolviendo el resultado correcto utilizando nuestros valores de prueba.
testString: 'assert.strictEqual(multiplesOf3and5(8456), 16687353, "Your function is not returning the correct result using our tests values.");'
Challenge Seed
function multiplesOf3and5(number) {
// Good luck!
return true;
}
multiplesOf3and5(1000);
Solution
const multiplesOf3and5 = (number) => {
var total = 0;
for(var i = 0; i < number; i++) {
if(i % 3 == 0 || i % 5 == 0) {
total += i;
}
}
return total;
};