Project Euler Problems 1 to 100 - Problem 1: Multiples of 3 or 5

Tell us what’s happening:

I think I’ve solved this problem but I am unable to get any code to run.

Here is my solution

function multiplesOf3Or5(number) {
  sum = 0;
  for (let i = 0; i < number; i++) {
    if (i % 3 == 0)  
      sum = sum + i;
    else if (i % 5 == 0)
      sum = sum + i;
  }  
  return sum;
}

multiplesOf3Or5(1000);

However none of the test cases are working, even the first “should return a number”. I don’t think the code is running and I don’t see any error. Why?

Your code so far

function multiplesOf3Or5(number) {

  return 1;
}

multiplesOf3Or5(1000);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0

Challenge Information:

Project Euler Problems 1 to 100 - Problem 1: Multiples of 3 or 5

you should be getting an error like sum is not declared or something like that.

You need to define sum

it’s great you want to help but maybe you want to focus on more recent topics