Forum Moderators: open
<html>
<body>
<script language="javascript" type="text/javascript">
var greetingString = "Hello "
var name = prompt("What is your name","Enter your name here please");
var dob = prompt("When were you born","please enter the year here");
document.write(greetingString + " " + name + "<BR/>");
document.write("you are" + 2004 - dob);
</script>
</body>
</html>
The other day I had to explicity declare values as Number()s.
a=200;
b=50;
thisNumber = a + b; returned
20050 so I ended up using (successfully)
a=200;
b=50;
thisNumber = Number(a) + Number(b); I hadn't had to do that, years ago when the first example would suffice. How is andre73's situation different? I know he's concatenating a string plus the result of subtracting two numbers, but I don't see the Number() function being used.