Currently, I am developing a basketball game stat tracker and need to update the field goal attempts every time I make a field goal or three-pointer. Additionally, I am looking for ways to optimize the javascript code provided.
The main requirement is to increment the value of 'sessionStorage.fgattempt' whenever both 'fgMade()' and 'threeMade()' functions are executed. It would also be helpful if the 'threeMade()' function also updated 'sessionStorage.threeattempt'.
<!DOCTYPE html>
<html>
<head>
<script>
// JavaScript functions here
</script>
<style>
/* CSS styles here */
</style>
</head>
<body>
<table>
<thead>
<tr>
<th>FGM</th>
<th>FGA</th>
<th>3PM</th>
<th>3PA</th>
<th>BLK</th>
<th>STL</th>
<th>DREB</th>
<th>OREB</th>
<th>TO</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div id="result1">N/A</div>
</td>
<td>
<div id="result2">N/A</div>
</td>
<td>
<div id="result3">N/A</div>
</td>
<td>
<div id="result4">N/A</div>
</td>
<td>
<div id="result5">N/A</div>
</td>
<td>
<div id="result6">N/A</div>
</td>
<td>
<div id="result7">N/A</div>
</td>
<td>
<div id="result8">N/A</div>
</td>
<td>
<div id="result9">N/A</div>
</td>
</tr>
</tbody>
</table>
<!-- Button elements with event listeners -->
</body>
</html>