split().splice().join() vs substring

Edit on GitHub

Setup

var stringToSplit = "page?param1=1&other=tester";

Tests

  • split().splice().join()

    var result = stringToSplit.split("?").splice(1,1).join("");
  • substring

    var result = stringToSplit.substring(stringToSplit.indexOf("?") + 1, stringToSplit.length);