Sum Multiple Fields

@J. D. this is the final code but the result of the sum is still 0

$w.onReady ( function () {
const inputs = [$w(“#J1”), $w(“#J2”), $w(“#J3”),$w(“#J4”),$w(“#J5”)];
$w(“#PT”).onViewportEnter((event) => {
let sum = 0;
inputs.forEach(i => {
if ( typeof i.value !== “undefined”){sum += Number(i.value);}
})
$w(“#PT”).text = sum.toString();
})
})