Skip to content

Instantly share code, notes, and snippets.

@very
Created November 3, 2012 00:33
Show Gist options
  • Save very/4005248 to your computer and use it in GitHub Desktop.
Save very/4005248 to your computer and use it in GitHub Desktop.
splitAt 2
function splitAt(string /* indexes... */) {
var i = 0, len = arguments.length, index = 0, parts = [];
while (i < len) {
parts[i] = string.substring(index, index = arguments[++i]);
}
return parts;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment