Revision 198792 of split

  • Revision slug: Talk:JavaScript/Reference/Global_Objects/String/split
  • Revision title: split
  • Revision id: 198792
  • Created:
  • Creator: Dleonard
  • Is current revision? Yes
  • Comment compatibility note

Revision Content

Compatibility note: in older versions of JS, when String.split() is given an undefined first argument, it converted it to the string 'undefined', instead of defaulting to ','.

"1undefined2undefined3".split(undefined) --> ["1","2","3"]    // not ECMA compliant

I'm not sure which version of JS this changed in. See also my corresponding note in Array.join()

Revision Source

<p>Compatibility note: in older versions of JS, when String.split() is given an undefined first argument, it converted it to the string 'undefined', instead of defaulting to ','.
</p>
<pre class="eval">"1undefined2undefined3".split(undefined) --&gt; ["1","2","3"]    // not ECMA compliant
</pre>
<p>I'm not sure which version of JS this changed in.
See also my corresponding note in <a href="Talk:en/Core_JavaScript_1.5_Reference/Global_Objects/Array/join">Array.join()</a>
</p>
Revert to this revision