How to Convert String to Array in Javascript
Posted on: February 17, 2021 by Ariessa Norramli
In this article, you will learn how to convert string to array in Javascript.
Let’s say you have a string variable named ‘a’ with value “codesource”.
var a = "codesource";
In order to convert a string to an array, you can use the split()
method.
var a = "codesource";
console.log(a.split(""));
Note: The split()
method functions by splitting the string into an array of characters.
Share on social media
//