slice vs substring vs substr

Edit on GitHub

Setup

var string = "I am the god of hellfire, and I bring you..."

Tests

  • slice

    var substring = string.slice(16, 24);
  • substring

    var substring = string.substring(16, 24);
  • substr

    var substring = string.substr(16, 8);