replace vs split join

Edit on GitHub

Setup

Tests

  • replace

    'asdfasdfasdfasdf'.replace(/a/g, 'banana')
  • split join

    'asdfasdfasdfasdf'.split('a').join('banana')