CHAPTER 2 BASIC JAVASCRIPT INSTRUCTIONS

Slides:



Advertisements
Similar presentations
JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Advertisements

Chapter 2 Review Questions
Bellevue University CIS 205: Introduction to Programming Using C++ Lecture 3: Primitive Data Types.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Javascript Client-side scripting. Up to now  We've seen a little about how to control  content with HTML  presentation with CSS  Javascript is a language.
10 November JavaScript. Presentation Hints What do YOU think makes a good presentation Some of my suggestions Don’t write full sentences on slides Talk,
Javascript II Expressions and Data Types. 2 JavaScript Review programs executed by the web browser programs embedded in a web page using the script element.
JavaScript, Fourth Edition
JavaScript, Third Edition
The Data Element. 2 Data type: A description of the set of values and the basic set of operations that can be applied to values of the type. Strong typing:
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
The Data Element. 2 Data type: A description of the set of values and the basic set of operations that can be applied to values of the type. Strong typing:
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
Week 9 PHP Cookies and Session Introduction to JavaScript.
2440: 211 Interactive Web Programming Expressions & Operators.
Chapter 3: Data Types and Operators JavaScript - Introductory.
Computers and Scientific Thinking David Reed, Creighton University JavaScript and User Interaction 1.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Done by: Hanadi Muhsen1 Tutorial 1.  Learn the history of JavaScript  Create a script element  Write text to a Web page with JavaScript  Understand.
DHTML AND JAVASCRIPT Genetic Computer School LESSON 5 INTRODUCTION JAVASCRIPT G H E F.
ITBP 119 Algorithms and Problem Solving Section 2.1 Installing software Section 2.2 First Programs Section 2.3 Variables.
An Introduction to Java – Part 1 Dylan Boltz. What is Java?  An object-oriented programming language  Developed and released by Sun in 1995  Designed.
CS346 Javascript -3 Module 3 JavaScript Variables.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
Data And Variables Chapter Names vs. Values Michael Jordan name (the letter sequence used to refer to something) value (the thing itself)
Introduction to JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
Chapter 3 AS3 Programming. Introduction Algorithms + data structure =programs Why this formula relevant to application programs created in flash? The.
Project 4: Working with Variables Essentials for Design JavaScript Level One Michael Brooks.
Chapter 4: Variables, Constants, and Arithmetic Operators Introduction to Programming with C++ Fourth Edition.
Expressions and Data Types Professor Robin Burke.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Chapter 10 Programming Fundamentals with JavaScript
Chapter 2 Variables.
Chapter 6 JavaScript: Introduction to Scripting
Variables Variables are used to store data or information.
JavaScript is a programming language designed for Web pages.
JavaScript Objects.
Multiple variables can be created in one declaration
Scope, Objects, Strings, Numbers
Exploring JavaScript Ch 14
JavaScript Syntax and Semantics
Type Conversion, Constants, and the String Object
Chapter 19 JavaScript.
JavaScript an introduction.
Chapter 10 Programming Fundamentals with JavaScript
INFO/CSE 100, Spring 2005 Fluency in Information Technology
Chapter 2 Variables.
JavaScript Data Concepts
T. Jumana Abu Shmais – AOU - Riyadh
JavaScript What is JavaScript? What can JavaScript do?
INFO/CSE 100, Spring 2006 Fluency in Information Technology
High Level Programming Languages
Tutorial 10 Programming with JavaScript
JavaScript What is JavaScript? What can JavaScript do?
JavaScript.
The Data Element.
Relational Operators.
Tutorial 10: Programming with javascript
JavaScript Basics What is JavaScript?
Introducing JavaScript
Variables Here we go.
The Data Element.
Chapter 2 Variables.
CIS 136 Building Mobile Apps
Variables and Constants
Lecture 9: JavaScript Syntax
Presentation transcript:

CHAPTER 2 BASIC JAVASCRIPT INSTRUCTIONS

STATEMENTS

Each individual step in a script is known as a statement.

Each statement should end with a semi-colon.

document.write(‘Welcome!’); SEMI-COLON

COMMENTS

You should use comments to explain what your code does You should use comments to explain what your code does. They help you remember it and others understand it.

MULTI-LINE COMMENTS

/* Anything between these characters is a comment and will not be processed. */

/* Anything between these characters is a comment and will not be processed. */

SINGLE-LINE COMMENTS

// Anything after the two // forward slashes is also // a comment and will not // be processed.

// Anything after the two // forward slashes is also // a comment and will not // be processed.

VARIABLES

Scripts often need to store bits of information temporarily in order to achieve their tasks.

These bits of information - or data - are stored in variables.

DECLARING A VARIABLE

var quantity;

var quantity; KEYWORD

var quantity; VARIABLE NAME

ASSIGNING A VALUE TO A VARIABLE

quantity = 3;

quantity = 3; VARIABLE NAME

quantity = 3; ASSIGNMENT OPERATOR

quantity = 3; VALUE

DATA TYPES

JavaScript distinguishes between numbers, strings, and true or false values known as Booleans.

1

1 NUMBERS 0.75 NO QUOTES

2 1 NUMBERS 0.75 NO QUOTES

1 2 0.75 ‘Hi Ivy!’ NUMBERS STRINGS NO QUOTES STRINGS ‘Hi Ivy!’ ENCLOSED IN QUOTES WHICH CAN BE SINGLE OR DOUBLE QUOTES, BUT MUST MATCH

3 1 2 0.75 ‘Hi Ivy!’ NUMBERS STRINGS NO QUOTES STRINGS ‘Hi Ivy!’ ENCLOSED IN QUOTES WHICH CAN BE SINGLE OR DOUBLE QUOTES, BUT MUST MATCH

1 2 3 0.75 ‘Hi Ivy!’ true NUMBERS STRINGS BOOLEAN NO QUOTES ENCLOSED IN QUOTES WHICH CAN BE SINGLE OR DOUBLE QUOTES, BUT MUST MATCH BOOLEAN true EITHER TRUE OR FALSE

ARRAYS

An array is a special type of variable An array is a special type of variable. It doesn’t just store one value; it stores a list of values.

colors = [ ];

colors = [‘pink’ ];

colors = [‘pink’,’yellow’ ];

colors = [‘pink’,‘yellow’,‘green’];

colors = [‘pink’,‘yellow’,‘green’];

colors = [‘pink’,‘yellow’,‘green’];

colors = [‘pink’,‘yellow’,‘green’];

colors = [‘pink’,‘yellow’,‘green’];

ARITHMETIC OPERATORS

JavaScript uses mathematics to get some tasks done.

var width = 3;

var width = 3; var height = 2;

var width = 3; var height = 2; area = width * height;

var width = 3; var height = 2; area = width * height;

var width = 3; var height = 2; area = width * height;

var width = 3; var height = 2; area = width * height;

6

CONCATENATING STRINGS

There is just one string operator: the + symbol There is just one string operator: the + symbol. It is used to join strings on either side of it.

var greeting = ‘Howdy ‘;

var greeting = ‘Howdy ‘; var name = ‘Molly’;

var greeting = ‘Howdy ‘; var name = ‘Molly’; var message = greeting + name;

var greeting = ‘Howdy ‘; var name = ‘Molly’; var message = greeting + name;

var greeting = ‘Howdy ‘; var name = ‘Molly’; var message = greeting + name;

var greeting = ‘Howdy ‘; var name = ‘Molly’; var message = greeting + name;

Howdy Molly