Académique Documents
Professionnel Documents
Culture Documents
PROGRAMMING WITH
JAVASCRIPT
Session 2: What is JavaScript?
Objectives
What is JavaScript?
What can JavaScript do?
JavaScript How to
JavaScript Where to
Writing JavaScript Statements
Writing JavaScript Comments
Declaring Variables in JavaScript
What is JavaScript?
Other Examples of
JavaScript Uses
http://grhainfo.org/codingbootcamp2/regi
stration.htm
http://www.gcsu.edu
JavaScript: Script
Element
In Class Example
In Class Examples
In body
In head
External JavaScript file
JavaScript Statements
JavaScript is a sequence of statements
to be executed by the browser.
JavaScript is case-sensitive.
A JavaScript statement is a command to
a browser. The purpose of the command
is to tell the browser what to do.
Example:
document.write("Hello Dolly");
JavaScript Statements
In Class Examples
JavaScript Code
JavaScript Code Block (use of a
function)
JavaScript Comments
JavaScript Comments
In-Class Example:
JavaScript Variables
Declaring JavaScript
Variables
Declaring a variable tells the JavaScript to
reserve memory space for the variable.
To declare a JavaScript variable, use the
statement
var variable;
where variable is the name assigned to the
variable.
To declare a JavaScript variable and set its
initial value, use
var variable = value;
where value is the initial value of the variable.
Declaring JavaScript
Variables
Numeric values
Text strings
Boolean values
Null values
Declaring JavaScript
Variables
Numeric value is any number, such as 13,
22.5,
-3.14159 etc.
Text string is any group of text characters,
such as Hello or Happy Holidays!
Declaring Variables
In Class Example