JavaScript

Package Management

NPM is used for package management.

curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure

This will install node and npm in /usr/local/bin.

IDE

Netbeans 8.0 has good JavaScript and even AngularJS support.

See Integrated AngularJS Development

Project Setup

File ⇒ New Project ⇒ HTML5 sets up a JavaScript project.

On Step 3 Site Template AngularJS Seed can be selected.

Additional JavaScript libraries can be selected on step 4.

This will not completely setup the new project.

npm install

needs to be executed from the command line in the project directory.

Libraries

Tips

Console Output

Output can be written by using the console.

console.log("My information");

Lifetime of Variables

The lifetime of a JavaScript variable starts when it is declared.

Local variables are deleted when the function is completed.

Global variables are deleted when you close the page.

Number Properties

  • MAX_VALUE
  • MIN_VALUE
  • NEGATIVE_INFINITY
  • POSITIVE_INFINITY
  • NaN
  • prototype
  • constructor

Number properties belongs to JavaScript's number object wrapper called Number.

These properties can only be accessed as Number.MAX_VALUE.

Using num.MAX_VALUE, where num is a variable, expression, or value, will return undefined.