split'n'shift vs find'n'index

Edit on GitHub

Setup

var str = 'yodoggy:hellokittycat'

Tests

  • split'n'shift

    str.split(':').shift()
  • find'n'index

    str.substr(0, str.indexOf(':'))