const num = 1234567;
const strNum = String(num);
function getPartialString(str, len) {
const result = [];
for (let i = 0; i < strNum.length - (len - 1); ++i) {
result.push(strNum.slice(i, i + len));
}
return result;
}
console.log(getPartialString(strNum, 3));
console.log(getPartialString(strNum, 4));
console.log(getPartialString(strNum, 5));