Languages
[Edit]
EN

JavaScript - convert string to character array

4 points
Created by:
AnnLen
11260

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
­čÜÇ
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