Javascript Glossary

This is a good Javascript Glossary to use: http://www.codecademy.com/glossary/javascript

A glossary of JS symbols: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Symbols

Also, you can use these definitions here to help you along the way:

Syntax

Operators

This is a great article explaining and giving examples of various operators.

$

In Jquery, this starts the main Object, so you can easily identify it at a glance. This is completely semantic, as it can be used or not used and your code will work all the same.

For a more in depth understanding of this symbol in Javascript, read this article.

Math.random();

Random number between 0 and 1 (includes fractions). 0.42, 0.87, etc.

Math.floor(expression);

Returns the largest integer less than or equal to a number. Rounds down to the nearest whole number.

More Info here.

Math.floor(Math.random() * 5 + 1);

Runs the math.random to get a random number between 0 and 1, then multiplies that fraction by a set number or number variable, then runs math.floor which rounds the number down to a whole number, then adds 1 to the result, effectively making it between 1 and 5 instead of 0 and 4 (since all math in JS is 0 based, not 1 based).

The result would be a randome whole number between the two numbers you specify, including those numbers. So the calculation above would give you either 1, 2, 3, 4 or 5.

Concepts

Function

A Function is a mini-program stored in a variable so you can use it over and over. It is useful for parts of your program which you need to run the same operation, but don't want to have to write out that operation each time you need it. Like a simple variable, but instead of just a value, it does stuff too.

Identifier

Another name for Variable

Method

Methods are like functions that are associated with a particular object. They are especially helpful when you want to either:

  • Update the object properties
  • Calculate something based on an object's properties.

Variable

A container which can hold information for later use.