There is an issue with the evalFormula that expects arrays but the code is designed to return strings, also I added optional support for lower case cell Ids in input, I changed update function to the code below and it works perfectly fine:
const update = event => {
const element = event.target;
let value = element.value.replace(/\s/g, "").toUpperCase();
if (!value.includes(element.id) && value.startsWith('=')) {
const inputs = Array.from(document.querySelectorAll("#container input"));
const cells = inputs.map(input => ({ id: input.id, value: input.value }));
element.value = evalFormula(value.slice(1), cells);
}
}
please comment your opinions for further improvements.