JSFiddle - React, Tailwind, and code Playground

HTML

<form>
	<input type="number" name="montant[]">
	<input type="number" name="montant[]">
	<input type="text" name="montant[]">
  <input type="button"  id="go" value="calcul" />
  <input type="input" id="res" type="text" readonly value="" />
</form>

JavaScript

function addUp(){
elts=document.getElementsByName('montant[]');
total=0
for ( myinput of elts) {
total += +myinput.value;
}
document.getElementById("res").value=total;
}

document.getElementById("go").addEventListener('click',addUp);