xxxxxxxxxx
const string = 'hi there';
const usingSplit = string.split('');
const usingSpread = [string];
const usingArrayFrom = Array.from(string);
const usingObjectAssign = Object.assign([], string);
// Result
// [ 'h', 'i', ' ', 't', 'h', 'e', 'r', 'e' ]
// From https://www.samanthaming.com/tidbits/83-4-ways-to-convert-string-to-character-array/
xxxxxxxxxx
const str = 'javascript';
const arr = [str];
// output:
// ['j', 'a', 'v', 'a', 's', 'c', 'r', 'i', 'p', 't']
xxxxxxxxxx
const str = "javascript";
const arr = str.split('');
console.log(arr);
// output:
// ['j', 'a', 'v', 'a', 's', 'c', 'r', 'i', 'p', 't']
xxxxxxxxxx
const str = 'javascript';
const arr = Array.from(str);
// output:
// ['j', 'a', 'v', 'a', 's', 'c', 'r', 'i', 'p', 't']
xxxxxxxxxx
const str = 'javascript';
const arr = Object.assign([], str);
// output:
// ['j', 'a', 'v', 'a', 's', 'c', 'r', 'i', 'p', 't']
xxxxxxxxxx
const str = 'javascript';
const arr = Array.prototype.map.call(str, x => x);
// output:
// ['j', 'a', 'v', 'a', 's', 'c', 'r', 'i', 'p', 't']