https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/substr
Из ссылки:
string.substr(start[, length])