So I have this bit of code for a calculator and it when I put something in the textbox, it only shows undefined. I need it when I put a mathematical expression like 1+1 it will show 2. You can see it in action in my website: G1blue.github.io/gencal.html
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Calculator: General (Under maintenance)</title>
<style>
h1{
font-size: 100px;
margin: auto;
}
div {
font-size: 100px;
position: absolute;
top: 150px;
}
</style>
</head>
<button><a href="index.html">Go to home</a></button>
<body>
<h1>Calculator: General</h1>
<input oninput="varChange()" id="equation" type="number">
<div id="answer"></div>
<script>
function varChange(){
var equation = document.getElementById("equation").value;
var answer = document.getElementById("answer");
answer.innerHTML = new Function(equation)()
}
</script>
</body>
</html>
How do you fix this?