Problem 1: Multiples of 3 and 5 - first test fails, others succeed?

Tell us what’s happening:
I pass the second and third test, but fail the first?

Checking in console: multiplesOf3and5(1000) returns 234168 instead of the asked for 233168. Am I missing something?

Your code so far

function multiplesOf3and5(number) {
  let sum = 0
  for (let i = 1; i <= number; i++){
    if(i %3 === 0 || i %5 === 0){
      sum += i;
  return sum;

Thanks for any help :slight_smile:

Sum of all multiples is not supposed to include number passed to function.
Reason why other tests pass is because they do not fulfill operation condition themselves.

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.


@arigoru, thanks so much, that makes it clear!

@ArielLeslie, thank you for that, I’ll keep it in mind next time :slight_smile: