Below is a simple approach to achieve the desired outcome:
const arrayElement = document.getElementById('arrayElement');
const variableElement = document.getElementById('variableElement');
const targetString = "122333444455555666666";
const dataSizes = [1, 2, 3, 4, 5, 6];
let result = [];
let position = 0;
dataSizes.forEach( (size) => {
result.push(targetString.substr(position, size));
position += size;
});
arrayElement.textContent = result.toString();
const [one, two, three, four, five, six] = result;
variableElement.textContent = `${one}-${two}-${three}-${four}-${five}-${six}`;