I'm trying to get the average of 4 grades and pass it in a text field.
It does get the average, the only part that doesn't work is the grade.value = grade; part
Here's my code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Week #10 JavaScript Assignment: Problem #1</title>
<script type = "text/javascript">
function calcgrade(one,two,three,four){
    sum = parseInt(one.value) + parseInt(two.value) + parseInt(three.value) + parseInt(four.value);
    grade = sum / 4;
    grade.value = grade;
}
</script>
</head>
<body>
<h1>Calculate Grade</h1>
<form>
    <table>
        <tr>
            <th>Assignment #</th>
            <th>Grade</th>
        </tr>
        <tr>
            <td>1</td> 
            <td><input type="text" id="one" name="one"></td>
        </tr>
        <tr>
            <td>2</td>
            <td><input type="text" id="two" name="two"></td>
        </tr>
        <tr>
            <td>3</td>
            <td><input type="text" id="three" name="three"></td>
        </tr>
        <tr>
            <td>4</td>
        <td><input type="text" id="four" name="four"></td>
        </tr>
        <tr><td colspan="2"><input type="button" onclick="calcgrade(one, two, three, four)" value="Calculate Grade"></td></tr>
        <tr>
            <td>Grade:</td>
            <td><input type="text" id="grade" name="grade"></td>
        </tr>
    </td>
</form>
</body>
</html>
 
     
     
     
    