จาวาสคริปต์เฉือนข้อความจากอักขระ
var input = 'john smith~123 Street~Apt 4~New York~NY~12345';
var fields = input.split('~');
var name = fields[0];
var street = fields[1];
จาวาสคริปต์แบ่งข้อความไปเป็นอาเรย์ของตัวอักษร
// split the text into array of chars using empty string
console.log("ABCDEFGHIJK".split(''));
// split the text into array of chars using empty string and limit to 3 chars
console.log("ABCDEFGHIJK".split('', 3));