Looking your original code, we can see that ", " is appended after each element. That's close, but not quite the way it works when writing a bunch of numbers on paper.
When we hand-write a list, we insert ", "
before each element
unless it's the first item.
So, an approach involves keeping track of the current element number. We then add ", " before each element except the first one.
function count(num1, num2)
{
var strCou = '';
var i = 0;
for(var input1 = num1; input1 <= num2; input1++)
{
if (i != 0)
strCou += ", ";
strCou += input1;
i++;
}
console.log(strCou);
}
count(2,5);