javascript - Why is the split method still returning a string -
I understand that the javascript's partition () method should take a string and pass it on to a parameter based on the parameters In the method should be divided into the array.
I have run the following in the console:
var sen = 'I like javascript'; Sen.split (''); Console.log (typeof (sen)); Then split ('') should split the string based on white space and return an array with 3 strings.
Although the console gives the typeface as "string" compared to the "object"
Does anyone know why?
Because split sen is not changed
sen Return value of 'split' (''); There will be an array. Try:
var sen = 'I like javascript'; Var arr = sen.split (''); Console.log (typeof (arrivals));
Comments
Post a Comment