i have wrote a code of HTML, but the JavaScript function is not called and i have an error message in the console: "myfunction is not a function"
<!DOCTYPE html>
<html>
<head></head>
<body>
<input type="text" id="mydata">
</body>
<script>
document.getElementById('mydata').addEventListener("change", myfunction);
if(typeof mydata.value === 'string' && mydata.value.length === 0){
console.log('outside function');
}
else{
function myfunction() {
console.log('inside function');
}
}
</script>
</html>