Stownheidg,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</head>
<body>
<input class="numbers" value="18">
<input class="numbers" value="22">
<input class="numbers" value="24">
<input class="sum">
<script>
document.querySelector('.sum').value = [...document.querySelectorAll('.numbers')].reduce((a, b) => a + +b.value, 0);
</script>
</body>
</html>