-
• #2
For me it's ok because you do not have the " separator in the 'HELLO' string so you get the same string as the result.
-
• #3
No, that's an empty string. A " separator would be '"' (a double quote enclosed in single quotes)
Correct behavior is to split a word up into letters like Sacha said - try it in any js console.
'HELLO'.split(''); ["H", "E", "L", "L", "O"]
-
• #4
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split
Syntax
str.split([separator][, limit])
Parameters
separator
Specifies the character(s) to use for separating the string. The separator is treated as a string or a regular expression. **If separator is omitted, the array returned contains one element consisting of the entire string**. If separator is an empty string, str is converted to an array of characters.
-
• #5
So you are right.
-
• #6
Also
"""
"HELLO".split();
=["", "H", "E", "L", "L", "O"]
//["HELLO"] expected
'''" -
• #7
Thanks - I'll try and get a fix for this in the next version.
Sorry Gordon,
Found another bug.
'HELLO'.slpit('');
returns:
=[
"HELLO"
]
Should return:
["H", "E", "L", "L", "O"]
Sacha