Skip to content


Our goal is to foster a deep understanding and appreciation of mathematics by using the tools of programming to manipulate and explore numbers. JavaScript is our programming language of choice and, as with any language, a foundation is needed to begin using it. This page is that starting point. We have endeavored to keep it short, simple, and to the point.

A Brief Introduction to JavaScript

We start by answering the twin questions of “what is JavaScript?” and “why are we using it?” The answer to both questions is the same: JavaScript is the language of the web browser. This means that you already have the tools you need to program in this language.

Beyond the ease of the installation, the language itself has minimal syntax. It does not require verbose declarations to, say, add two numbers together. It is also very flexible, which is great for the kind of quick programming that our site is about. A JavaScript program can be as short as:

console.log(2+5); // outputs 7

To get a sense for what this code means, let’s go through it bit by bit. We’ll also outline a few additional basics.

  • console.log() Anything between this function’s parentheses is evaluated, with the result outputted to a browser’s debugging environment (see Useful Tools). Multiple expressions can be used if they are separated by commas.
  • 2+5 Does exactly what it looks like, adding 2 and 5.
  • ; Semicolons are used to terminate statements. Forgetting the semicolon is a common mistake.
  • // outputs 7 The double slash indicates that everything from it to the end of the line is a comment and should not be evaluated. This is also handy for quickly disabling a line of code.
  • /* this was not here */ These symbols indicate that whatever is between them is also a comment. This type of comment can span multiple lines.
  • alert(6+3); This function evaluates whatever is between the parentheses and pops up an alert dialog with the output.

Useful Tools

We use jsFiddle to make our examples interactive. Try clicking the line of code in the previous section to open an interactive version in its own tab. In that tab, clicking “Update” runs the code. You can modify the examples, save them as your own, and share them with others.

As you experiment with your code, you may want some help inspecting it and identifying errors. Both Safari and Chrome offer native debugging tools. Firefox has a wonderful extension called Firebug.

Foundational Posts

These are posts that we recommend beginners go through and are comfortable with before they proceed any further. They introduce the key aspects of JavaScript. Other posts will assume these as a foundation.