_.split

❗️Lodash onlySplits string by separator.

  1. // Lodash
  2. var result = _.split('a-b-c', '-', 2)
  3. console.log(result)
  4. // output: ['a','b']
  5.  
  6. // Native
  7. var result = 'a-b-c'.split('-', 2)
  8. console.log(result)
  9. // output: ['a','b']

Browser Support for String.prototype.split()

ChromeEdgeFirefoxIEOperaSafari
1.0 ✔