際際滷

際際滷Share a Scribd company logo
Working with JavaScript

The Javascript code is placed between <body> and
</body> tags in HTML.

The start of javascript code begins as <script
type=text/javascript> and </script> tags.

You would find a semicolon at the end of a
javascript statement. (;)

A comment phrase begins with a //. Phrases can
be introduced to make the program more readable.
This would not be executed by computer
Variables
Variables can be compared to small boxes with names.
If you were to store 5 pair of shoes, you might have a box
for each pair. On each box you would write what is in it.

The boxes would be your variables.
(Places to store things.)

The name on the boxes would be the variable names.
( The ones you'd use when referring to each of the boxes.)

And finally the shoes, would be the content of the
variables.
(What is stored in the boxes.)
Rules of Variables
We must follow a set of rules for creating a
variable in JavaScript such as-

Names are case sensitive. For example
LENGTH is not the same as length.

Variable name should begin with a letter or
underscore (_). For example 3number is a
wrong variable name.
Rules of Variables

Keywords (special words that are used for
specific purposes by javascript, should not
be used as variable names.

It is recommended to use meaningful
variable names. For example first name is
Firstname.

More Related Content

Lesson 4 maya 3

  • 1. Working with JavaScript The Javascript code is placed between <body> and </body> tags in HTML. The start of javascript code begins as <script type=text/javascript> and </script> tags. You would find a semicolon at the end of a javascript statement. (;) A comment phrase begins with a //. Phrases can be introduced to make the program more readable. This would not be executed by computer
  • 2. Variables Variables can be compared to small boxes with names. If you were to store 5 pair of shoes, you might have a box for each pair. On each box you would write what is in it. The boxes would be your variables. (Places to store things.) The name on the boxes would be the variable names. ( The ones you'd use when referring to each of the boxes.) And finally the shoes, would be the content of the variables. (What is stored in the boxes.)
  • 3. Rules of Variables We must follow a set of rules for creating a variable in JavaScript such as- Names are case sensitive. For example LENGTH is not the same as length. Variable name should begin with a letter or underscore (_). For example 3number is a wrong variable name.
  • 4. Rules of Variables Keywords (special words that are used for specific purposes by javascript, should not be used as variable names. It is recommended to use meaningful variable names. For example first name is Firstname.