Main Menu
Multiwingspan Home Page
Multiwingspan Games
Gnasher @ Multiwingspan
Multiwingspan Calendar
Multiwingspan Clock
About Multiwingspan
Programming
Visual Basic 6.0 Guide
Visual Basic 6.0 Examples
Turbo Pascal Guide
SWI Prolog Guide
Visual Basic 2005 Guide
Structured Query Language
Web Design
HTML Design Tasks
Introduction To HTML
Introduction To CSS
Introduction To Javascript
Notes
AS/A2 Level Computing

Javascript Guide
Operators

Introduction

Operators are used to change or gather information about variables. This page will deal only with basic arithmetical operators. Other types of operator (eg logical - and, not etc.) will appear in the guide when used in the context of a specific script.

Arithmetic with Variables

The following lines of code will add the variables a and b together and post the result in a message box.

var a = 5
var b = 10
var answer = a + b
alert("The answer is " + answer)

Exercise 7

Bearing in mind that Javascript uses the standard computer characters for arithmetic (+ - * /), create a script which will add, subtract multiply and divide the two numbers specified. Change the values of a and b a few times to see the effect.

Return To Javascript Guide || Return To Homepage