showing results for - "how to seperate words seperated by commas using javascript"
Abagail
05 Jun 2016
1var names = 'Harry,John,Clark,Peter,Rohn,Alice';
2var nameArr = names.split(',');
3console.log(nameArr);
4    
5// Accessing individual values
6alert(nameArr[0]); // Outputs: Harry
7alert(nameArr[1]); // Outputs: John
8alert(nameArr[nameArr.length - 1]); // Outputs: Alice