I have an assignment in javascript that changes the font of the tag on button click but I'm getting this error. I don't think there is anything wrong in my code.
<button onclick="myFunction()">Set font</button>
<script type = "text/javascript">
function myFunction() {
document.getElementsByTagName("body").style.fontFamily = "Times New Roman, Times, serif";
}