Languages
[Edit]
EN

JavaScript - convert string to character array

4 points
Created by:
Maison-Humphries
371

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);

 

JavaScript - String (popular problems)

JavaScript - convert string to character array
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join