EN
JavaScript - convert string to character array
4 points
In this article, we would like to show you how to convert string to characters array in JavaScript.
xxxxxxxxxx
1
var text = 'ABCD';
2
var array = text.split('');
3
console.log(array);
xxxxxxxxxx
1
var text = 'ABCD';
2
var array = Array.from(text);
3
console.log(array);
xxxxxxxxxx
1
var text = 'ABCD';
2
var array = Object.assign([], text);
3
console.log(array);