Hello everyone, very sorry upfront for the poor code. I need the script to spit out the person name not NaN. Basically what is happening is the script asks for a number and your name. The program is supposed to spit out your commission rate and your name. The script will spit out the commission rate just fine but the name shows up as NaN. please explain what I am doing wrong so that I may learn. Thank you.
Code:
<html>
<head>
<title>Patrick - assignment03 - Exercise 2<</title>
</head>
<body bgcolor="DeepSkyBlue" text="wheat">
<script language="JavaScript" type="text/javascript">
alert("Welcome to Commission Calculator")
var num1 = prompt("Please enter your Total Sales Amount: ", "" );
var name= prompt("Please enter your Name: ", "" );
document.write("===== Sales Commission Script ======", "<br>")
document.write("====== by Patrick ===========", "<br>")
if (num1 <= 9999)
document.write( +name+ " Your commission is " , (num1) * .02, "<br>")
else if (num1 >= 10000)
document.write( +name+ " Your commission is $" , (num1) * .05 + 200, "<br>")
</script>
</body>
</html>