Javascript how to split string characters into variables -


i trying split string's characters variables this:

<script> var string = "hello"; //after splitting: var stringat1 = "h"; var stringat2 = "e"; var stringat3 = "l"; var stringat4 = "l"; var stringat5 = "o"; </script> 

could give example of how can done?

string.prototype.split() function can used requirement.

the split() method splits string object array of strings separating string substrings.

usage

var string = "hello";  var arr = string.split('');  var stringat1 = arr[0];  alert(stringat1)


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -