<input type="hidden" id="myField" value="" />
document.getElementById('myField').value = product(2, 3);