function solution(number){
  let multiples = []
  let index = 1
  while(index < number){
    if (index % 3 == 0 || index % 5 == 0) {
      multiples.push(index)
    }
    index++;
  }
  return multiples.reduce((acc,value) => acc+value)
}

console.log(solution(10))

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.