How does JavaScript work and how can I build simple calculators with it?
JavaScript is what is called a Client-side Scripting Language . That means that it is a computer programming language that runs inside an Internet browser (a browser is also known as a Web client because it connects to a Web server to download pages). The way JavaScript works is interesting. Inside a normal Web page you place some JavaScript code (See How Web Pages Work for details on Web pages). When the browser loads the page, the browser has a built-in interpreter that reads the JavaScript code it finds in the page and runs it. Web page designers use JavaScript in many different ways. One of the most common is to do field validation in a form. Many Web sites gather information from users in online forms, and JavaScript can help validate entries. For example, the programmer might validate that a person’s age entered into a form falls between 1 and 120. Another way that web page designers use JavaScript is to create calculators. Here are several examples: •