var analizOfNumber = function(number) {
  var pingPongNumber = number;
  if (number % 3 === 0 && number % 5 === 0) {
    pingPongNumber = "pingpong";
  } else if (number % 3 === 0) {
      pingPongNumber = "ping";
  } else if (number % 5 === 0) {
    pingPongNumber = "pong";
  };
  return pingPongNumber;
}

var pingPongSequence = function (userNumber) {
  var sequenceOfNumbers = [];
  for (var i = 1; i <= userNumber; i++ ) {
    sequenceOfNumbers.push(analizOfNumber(i));
  }
  return sequenceOfNumbers;
}

$(document).ready(function() {
  $("button#pingpong").click(function() {
    $("#result ul").children("li").remove();
    var pingPongArray = [];
    pingPongArray = pingPongSequence($("input#userInputNumber").val());
    for (i=0; i<=pingPongArray.length-1; i++) {
      $("#result ul").append("<li>"+pingPongArray[i]+"</li>");
    }
  });
});

@@ -26,25 +26,24 @@
 tion(number)
- 
 %7B%0A  var ping
@@ -648,32 +648,8 @@
 ay =
- %5B%5D;%0A    pingPongArray =
  pin
@@ -705,50 +705,53 @@
     
-for (i=0; i%3C=pingPongArray.length-1; i++) 
+pingPongArray.forEach(function(pingPongArray)
 %7B%0A  
@@ -801,11 +801,8 @@
 rray
-%5Bi%5D
 +%22%3C/
@@ -813,16 +813,18 @@
 );%0A    %7D
+);
 %0A  %7D);%0A%7D

refactor jQuery script which display the result