How to convert string to array or list in javascript?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How to convert string to array or list in javascript??

convert string to array or list.

12th Jun 2019, 2:57 PM
Saeed Alqassabi
Saeed Alqassabi - avatar
4 Answers
+ 5
Do you mean take every character of a string and put it into an array? string.split(“”); should work just fine
12th Jun 2019, 3:03 PM
Jax
Jax - avatar
+ 3
I will try to use that it will help me in my next code.thank you.
12th Jun 2019, 3:04 PM
Saeed Alqassabi
Saeed Alqassabi - avatar
+ 2
mystring.split(“ ”) thats if the things in a string are separated by white space mystring.split(“,”) if separated by a comma
13th Jun 2019, 12:04 AM
Logomonic Learning
Logomonic Learning - avatar
+ 1
you can to convert string to int, float, and even object and some more times. But you can do an Array from Variable
27th Jun 2019, 12:15 AM
КУБИЧЕСКИЙ ГЕЙМЕР
КУБИЧЕСКИЙ ГЕЙМЕР - avatar