formElement.reset()
<!DOCTYPE html>
<html>
<head>
<title> reset() method </title>
</head>
<body style = "text-align: center;">
<div style = "background: pink;">
<font color = "red" size = "6px">
<b> Example of the reset() method </b>
</font>
</div>
<div style = "background: lightblue;">
<form id = "myForm" action = "#" style = "font-size: 20px;" >
<p> First Name: <input type = "text" id = "fname" /></p>
<p> Last Name: <input type = "text" id = "lname" /></p>
<p> E-mail Id: <input type = "email" id = "email" /></p>
<p> Age: <input type = "number" id = "age" /></p>
<input type = "submit">
<input type = "button" value = "Reset data" onClick = "fun()"/>
</form>
</div>
<script>
function fun(){
document.getElementById("myForm").reset();
}
</script>
</body>
</html>