Languages
[Edit]
EN

JavaScript - convert string to character array

4 points
Created by:
AnnLen
9120

1. Using String split() method

// ONLINE-RUNNER:browser;

var text = 'ABCD';
var array = text.split('');
console.log(array);

2. Using Array.from() method

// ONLINE-RUNNER:browser;

var text = 'ABCD';
var array = Array.from(text);
console.log(array);

3. Using Object.assign()

// ONLINE-RUNNER:browser;

var text = 'ABCD';
var array = Object.assign([], text);
console.log(array);

 

Native Advertising
50 000 ad impressions - 449$
🚀
Get your tech brand or product in front of software developers.
For more information contact us:
Red dot
Dirask - friendly IT community for everyone.

❤️💻 🙂

Join