Can anyone help me correct what I am missing in order to output the result on web browser using ID.
<p id="demo5"></p>
<script>
function sum(...theArgs) {
return theArgs.reduce((previous, current) => {
return previous + current;
});
}
console.log(sum(1, 2, 3)); // this works
console.log(sum(1, 2, 3, 4)); // this works
document.write(sum(1,2,3,4))// this works on console log
document.getElementById("demo5").innerHTML = what should I put here? Do I need to define something up in there?