function change(o)
{
var str = "";
for (var p = 0; p<=o ;p++)
{
temp = p;
str = str + temp;
if (p == o){
}
else{
str = str + ",";
}
}
console.log(str);
}
change(5);
(consolelog will be changed into return, it's just to view the output)
Basically, I am a beginner who recently started and I wanted to make a simple function that returns a value of the function. For example; if change(5) was inputted, it would return a string value of 5 x's, so xxxxx. If it was change(7), it would return me xxxxxxx, so any idea how to do this? Because my code only gives value from 0 to my inputted value.