Ok, so I am trying to call the convert function in the calculate_drug function but the final "sotp" "start" alert keeps coming up as undefined. I am assuming this is because it thinks convert is not defined. This is a python code I'm trying to convert to JS and I'm obviously not very familiar with JS.
What am I doing wrong here?
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>Click the button</p>
<button onclick="calculate_drug()">Drug</button>
<script>
function convert(time)
{
minutes = time.substr(-2)
hours = Math.floor(time/100)
con_time = (hours * 60) + parseInt(minutes)
}
function calculate_drug(start, stop)
{
start = prompt("Enter Start Time")
stop = prompt("Enter Stop Time")
start = convert(start)
alert(start)
stop = convert(stop)
alert(stop)
}
</script>
</body>
</html>
varprompt. It's weird, but there it is.