how to print as follows in javascript ?
if my input is "smart" then my output could be "s,m,a,r,t"
I've tried by using this logic but i got the output as s,m,a,r,t,
let a = " ";
str = userInput[0];
console.log(str);
for (let i = 0; i < str.length; i++) {
a = a + str[i] + ",";
}
console.log(a.trim());