So, i'm trying to make a code that after submiting 3 notes it can calculate the average and the maximun note, but when trying to pass that data from my javascript function to a html paragraph the page just refreshes and doesn't show the result.
    function calculateAverage(){
    var maths = document.getElementById('nMaths').value;
    var language = document.getElementById('nLanguage').value;
    var history = document.getElementById('nHistory').value;
    var sumNotes = parseFloat(maths) + parseFloat(language) + parseFloat(history);
    var average = sumNotes / 3;
    var result = "Your average is " + average;
    document.getElementById('average').innerHTML = result;
}<form id = "form" method="POST" action="notes.html">
    <div>
        <label> Enter maths note: </label>
        <input id = "nMaths">
    </div>
    <div>
        <label> Enter language note: </label>
        <input id = "nLanguage">
    </div>
    <div>
        <label> Enter history note: </label>
        <input id = "nHistory" type="numer">
    </div>
    <button onclick="calculateAverage()"> Calculate average </button>
    <button onclick="calculateBestNote()"> Calculate your best note </button>
</form>
<div>
    <p id = "average" name = "average"> Your average is: </p>
    <p id = "bestNote" name = "bestNote"> Your best note is: </p>
</div>var result = "Your average is " + average;
document.getElementById('average').innerHTML = result;
}
