+ 1
Convert string to array?
In JavaScript, how do I convert a string to an array? For example, var a = “hello” ; var b = a ... #however you convert to array #b[1] = “e” How do I gets this result? I’m trying to output a string one letter at a time to make it look like I’m typing. Thanks for any answers.
8 odpowiedzi
+ 12
to convert a string to an array use split():
var string="hello";
string=string.split("");
console.log(string);
//h,e,l,l,o
+ 8
Xan first of all,i clearly recall we both answered at the same time,also im highly disappointed youre more concerned about attention than the fact that youve shared your knowledge.Thanks for the downvote anyway,your maturity is as clear as crystal
+ 5
xan firstly im not downvoting you,i hate doing that,and itsnt my fault this happened
+ 5
see i have better things to do in real life,im less concerned about downvoting people or giving a thing of who likes my comments or not.Well..nice day xan
+ 4
🇳🇬Brains Anyway, huge compassion to you. I've had a brutal week. Apologies for being out of line with you. I've followed you ☺ You're a good person.
+ 1
Thanks for all the answers... and the maturity 😂. I’ll try to use this, thank you
+ 1
This
var a = "hello" ;
var b = a.split("") ;
console.log(b[1]) ;
works. Thanks for the name of the method!