0

So I have a string similar to the following:

var mystring = "aasfeeeffdbals";

and I need to make it an array filled with the individual chars. I know what I can do that with the following method:

var charArray = []
for (var i = 0; i<mystring.length; i++) {
    charArray.push(mystring[i]);
}

QUESTION: My understanding of a string is that it already in essence is an array of characters put together, so might there be a more straight forward way of creating a new array with the characters from the string?

Webeng
  • 6,796
  • 4
  • 27
  • 55

1 Answers1

3

var chars = "aasfeeeffdbals".split(''); will bring you wanted result

meta4
  • 758
  • 1
  • 11
  • 24