Hi, I am wondering how I would be able to do this code. I have an idea on how to make the javascript code, but I'm not sure if my code is correct. The question I have been given is:
Design and develop a javascript program that will determine if input number is positive and negative.Consider zero(0) as positive(considering that it contains no negative sign).
here is my javascript code, I'm not sure if this is correct based on the question above.
<!DOCTYPE html>
<html>
<head>
<title>activity 1</title>
</head>
<body>
<script type="text/javascript">
var stringNumber = prompt("Enter Number: ", "");
stringNumber = parseInt(stringNumber);
if(stringNumber >=80){
document.write("Positive");
}else{
document.write("Negative");
}
</script>
</body>
</html>
any answers are greatly appreciated.
if(stringNumber >= 0)- you should also look at providing 10 as the second argument to parseInt().