I am getting this error Uncaught ReferenceError: cmd is not defined at HTMLButtonElement.onclick whenever clicked on button
<!DOCTYPE html>
<html>
<head>
<title>my location</title>
</head>
<body>
<h1>location</h1>
<button onclick="cmd()">Get location</button>
<div id="output"></div>
<script>
var x = document.getElementById('output');
function cmd() {
if (navigator.Geolocation) {
alert("supports location")
} else {
alert("doesn't support")
}
}
</script>
</body>
</html>