JavaScript Code

How to split string into array of characters in JavaScript?

Split string into array of characters in JavaScript

In this tutorial, you are given a string, and you will learn how to split the string into an array of characters.


To split string str into an array of characters in JavaScript, call String.split() method on the string str, and pass empty string as separator (argument).



1. In the following program, we take a string value 'apple' and split this string into array of characters.

let name = 'apple';
let output = name.split('');