Если так:
const parentsOfAllElements = document.body;
const divCalculator = document.createElement('div');
divCalculator.className = 'calculator-grid';
parentsOfAllElements.appendChild(divCalculator);
const divOutput = document.createElement('div');
divOutput.className = 'output';
divCalculator.appendChild(divOutput);
const btns = ['AC', 'DEL', '÷', 1, 2, 3, '*', 4, 5, 6, '+', 7, 8, 9, '-', '.', 0, '='];
for (let i = 0; i < btns.length; i++) {
let btn = document.createElement('button');
btn.innerText = btns[i];
if (typeof btns[i] == 'number') {
btn.setAttribute('data-number', '');
}
else if (btns[i].length == 1) {
btn.setAttribute('data-operation', '');
}
else if (btns[i] == 'AC') {
btn.setAttribute('data-all-clear', '');
btn.className = 'span-two';
}
else if (btns[i] == 'DEL') {
btn.setAttribute('data-delete', '');
}
divCalculator.appendChild(btn);
}