1<script>
2var names = 'Harry,John,Clark,Peter,Rohn,Alice';
3var nameArr = names.split(',');
4console.log(nameArr);
5
6// Accessing individual values
7alert(nameArr[0]); // Outputs: Harry
8alert(nameArr[1]); // Outputs: John
9alert(nameArr[nameArr.length - 1]); // Outputs: Alice
10
11var str = 'Hello World!';
12var chars = str.split('');
13console.log();
14
15// Accessing individual values
16alert(chars[0]); // Outputs: H
17alert(chars[1]); // Outputs: e
18alert(chars[chars.length - 1]); // Outputs: !
19</script>
1// bad example https://stackoverflow.com/questions/6484670/how-do-i-split-a-string-into-an-array-of-characters/38901550#38901550
2
3var arr = foo.split('');
4console.log(arr); // ["s", "o", "m", "e", "s", "t", "r", "i", "n", "g"]
1string fruit = "Apple,Banana,Orange,Strawberry";
2string[] split = fruit.Split(',');