Revisiting Strings and Numbers
Let's quickly revisit strings and numbers with an example of a very simple JavaScript calculator! In this example, you'll not only look at a way to use operators but you will also find out how you can change string digits to numbers through a process called type conversion. |
The JavaScript Calculator
1. |
Start off with the bare HTML template:
<html> <head> <title>A Simple Page</title> <script language="JavaScript"> <!-- Cloaking device on! // Cloaking device off --> </script> </head> <body> </body> </html> |
2. | Declare the variables you will use here. You should have two variables for each of the numbers the user ... |
Get JavaScript™ 1.5 by Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.