Why cant my code check if the number is odd or even? The alert always says that the number is odd. The result is the same whether I have x in the function brackets or not.
<!DOCTYPE html>
<html>
<head>
<script>
function check(x){
if(x % 2 == 0){
alert('even');
} else{
alert('odd');
}
}
function store(x){
function save(x){
var x = document.getElementById('x');
localStorage.setItem('x',x.value);
}
save(x);
check(x);
}
</script>
</head>
<body>
<form id="form" onsubmit="store()">
<label>x=</label>
<input type="text" id="x">
<input type="submit">
</form>
</body>
</html>