_.startsWith

❗️Lodash onlyChecks if string starts with the given target string.

  1. // Lodash
  2. var result = _.startsWith('abc', 'b', 1)
  3. console.log(result)
  4. // output: true
  5.  
  6. // Native
  7. var result = 'abc'.startsWith('b', 1)
  8. console.log(result)
  9. // output: true

Browser Support for String.prototype.startsWith()

ChromeEdgeFirefoxIEOperaSafari
41.0 ✔17.0 ✔28.0 ✔9.0 ✔