0

String to array

How to convert a string to an array in JavaScript ? let's say i got "Hello World" as a string (var str = "Hello World"); and I want to convert it to an array so I can use its letters as items with indexes and alert the whichever one I want. how can i do that? Any help would be appreciated. Thanks in advance. :)

18th Dec 2017, 2:11 AM
BRKOTTA
BRKOTTA - avatar
6 Antworten
18th Dec 2017, 2:34 AM
Lord Krishna
Lord Krishna - avatar
18th Dec 2017, 2:22 AM
James16
James16 - avatar
+ 2
Hi, a String is an array of characters ej: var text = "Hola"; var word = text[2]; alert(word); The exit is "l". I hope I've helped. PD: Sorry if i commeted a mistake but i learning english.
18th Dec 2017, 2:20 AM
Emmanuel David Angarita Quintanilla
Emmanuel David Angarita Quintanilla - avatar
+ 1
@Lord Krishna thank you, that seems to be a helpful website
18th Dec 2017, 2:40 AM
BRKOTTA
BRKOTTA - avatar
0
@Emmanuel thank you man, yes you've helped , no don't be sorry you're totally fine, we are all learning. thank you again.
18th Dec 2017, 2:33 AM
BRKOTTA
BRKOTTA - avatar
0
@James16 thank you man, although that wasn't what I was talking about but I did learn something from it. Thank you.
18th Dec 2017, 2:35 AM
BRKOTTA
BRKOTTA - avatar