view core-javascript/getting-started.rst @ 213:0ea90a1819c2 default tip

Custom theming
author Radomir Dopieralski <radomir.dopieralski@allegro.pl>
date Wed, 27 Jun 2012 16:35:54 +0200
parents a21e804c9b2a
children
line wrap: on
line source

Getting started
===============

What you need
-------------

You'll need on your machine

#.  A JavaScript interpreter which provides a command line

#.  An editor on your machine.

You'll also to download and unzip the course :download:`work folder
</core-javascript-work.zip>`.


Windows and Linux
-----------------

For Windows the easiest thing to do is to `download the JSDB
interpreter <http://www.jsdb.org/download.html>`_, and use notepad (or
some other editor).

For Linux you and install Rhino and use your favourite editor.

.. code-block:: sh

   $ sudo apt-get install rhino


Are you ready?
--------------

You'll want to be able to run the JavaScript interpreter from the
command line when in the work folder.  This will be automatic (via the
PATH) with Linux and Rhino.  For Windows the easiest thing to do is to
place the jsdb.exe file in the work folder.

When you're ready type *js* at a command prompt.  This starts the
interpreter and gives you a *js>* prompt. You'll get something like
this.

.. code-block:: javascript

   core-javascript-work$ js
   Rhino 1.7 release 2 2010 01 20
   js>

Now type the command as below at the JavaScript prompt (with Return at the end of
each line) and you'll get responses as below.


.. code-block:: javascript

   js> a = '0'
   0
   js> b = 0
   0
   js> c = ''

   js> a == b
   true
   js> b == c
   true
   js> a == c
   false


You might be surprised by the last response from the interpreter, but
every JavaScript interpreter does this.


Yes, you're ready
-----------------

To exit the interpreter use Ctrl-C or Ctrl-D.