Skip to content

Instantly share code, notes, and snippets.

@z2015
Created July 19, 2016 01:31
Show Gist options
  • Save z2015/27800dc901f55954f6aef7a942e3806e to your computer and use it in GitHub Desktop.
Save z2015/27800dc901f55954f6aef7a942e3806e to your computer and use it in GitHub Desktop.
Substr vs Substring
var status = '.status-0'
console.log(status.substr(2,2)); //first param by begin, second by cut length, got 'ta'
console.log($(this).attr('data-filter').substring(2,4)); // first param by begin index, second by sub index string. got 'ta' also .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment