Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more

i know it's too late to reply ...but as said in the previous comment your Code is fine you just need some little changes..and because i am a bad explainer i am just going to show my simple version of the code .....

Code
Diff
  • //if you have any Suggestion or noticed a mistake in my code ...tell me...i would need that...
    function test(n) {
      var sum=0;
      for (i=1; i<n; i++){
        if ((i%3==0) || (i%5==0)){
        sum+=i;
        }
      }
       return sum;
    }
  • 1-function test() {
    2- var a = [];
    3- for (i=1; i<10; i++){
    1+//if you have any Suggestion or noticed a mistake in my code ...tell me...i would need that...
    2+function test(n) {
    3+ var sum=0;
    4+ for (i=1; i<n; i++){
    44 if ((i%3==0) || (i%5==0)){
    5- a.push(i);
    6+ sum+=i;
    66 }
    77 }
    8- return a;
    9+ return sum;
    99 }
    10-
    11-function sum(number){
    12- var sum= 0;
    13- for(i=0; i<number.length; i++){
    14- sum += number[i];
    15- }
    16- return sum;
    17- }
    18-var ab = test();
    19-var abc = sum(ab);
    20-console.log(abc);