JavaScript Syntax. Web Authoring and Design. Benjamin Kenwright

Similar documents
Javascript Events. Web Authoring and Design. Benjamin Kenwright

Object Orientated Analysis and Design. Benjamin Kenwright

Web Application Development

Inheritance and Interfaces

Introduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p.

Introduction to Programming Using Java (98-388)

CGS 3066: Spring 2015 JavaScript Reference

Typescript on LLVM Language Reference Manual

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan

Manju Muralidharan Priya. CS4PM Web Aesthetics and Development WEEK 12

CSS Selectors. Web Authoring and Design. Benjamin Kenwright

Java Basics. Object Orientated Programming in Java. Benjamin Kenwright

SECTION II: LANGUAGE BASICS

Introduction to C++ Introduction. Structure of a C++ Program. Structure of a C++ Program. C++ widely-used general-purpose programming language

Introduction to C++ with content from

Revising CS-M41. Oliver Kullmann Computer Science Department Swansea University. Robert Recorde room Swansea, December 13, 2013.

CSC Web Programming. Introduction to JavaScript

C++ (Non for C Programmer) (BT307) 40 Hours

Chapter 3 Data Types and Variables

JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)

Lesson 06 Arrays. MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL

JavaScript: Coercion, Functions, Arrays

Such JavaScript Very Wow

Princess Nourah bint Abdulrahman University. Computer Sciences Department

Discover how to get up and running with the Java Development Environment and with the Eclipse IDE to create Java programs.

Sprite an animation manipulation language Language Reference Manual

Working with JavaScript

PHP. Interactive Web Systems

JScript Reference. Contents

Notation Part 1. Object Orientated Analysis and Design. Benjamin Kenwright

Computer Science II (20082) Week 1: Review and Inheritance

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341)

JavaScript. Training Offer for JavaScript Introduction JavaScript. JavaScript Objects

JavaScript for C# Programmers Kevin

1. Describe History of C++? 2. What is Dev. C++? 3. Why Use Dev. C++ instead of C++ DOS IDE?

MatchaScript: Language Reference Manual Programming Languages & Translators Spring 2017

Java+- Language Reference Manual

PHPoC. PHPoC vs PHP. Version 1.1. Sollae Systems Co., Ttd. PHPoC Forum: Homepage:

CSE115 / CSE503 Introduction to Computer Science I. Dr. Carl Alphonce 343 Davis Hall Office hours:

Revising CS-M41. Oliver Kullmann Computer Science Department Swansea University. Linux Lab Swansea, December 13, 2011.

Client-Side Web Technologies. JavaScript Part I

Flow Control. CSC215 Lecture

Internet & World Wide Web How to Program, 5/e by Pearson Education, Inc. All Rights Reserved.

CS112 Lecture: Primitive Types, Operators, Strings

Flow Control Continued

What is PHP? [1] Figure 1 [1]

COMSC-051 Java Programming Part 1. Part-Time Instructor: Joenil Mistal

MultiThreading. Object Orientated Programming in Java. Benjamin Kenwright

Protection Levels and Constructors The 'const' Keyword

Rule 1-3: Use white space to break a function into paragraphs. Rule 1-5: Avoid very long statements. Use multiple shorter statements instead.

Values and Variables 1 / 30

JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)

Internal Classes and Exceptions

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic

Darshan Institute of Engineering & Technology for Diploma Studies Unit 2. 2 Working with JavaScript

Decaf Language Reference Manual

Introduction to Computer Programming CSCI-UA 2. Review Midterm Exam 1

JavaScript. What s wrong with JavaScript?

CA4003 Compiler Construction Assignment Language Definition

What is Java Script? Writing to The HTML Document. What Can JavaScript do? CMPT 165: Java Script

Overview: Programming Concepts. Programming Concepts. Names, Values, And Variables

Overview: Programming Concepts. Programming Concepts. Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript

JavaScript: More Syntax and Using Events

Object oriented programming. Instructor: Masoud Asghari Web page: Ch: 3

VARIABLES AND TYPES CITS1001

PHPoC vs PHP > Overview. Overview

The action of the program depends on the input We can create this program using an if statement

Hyperlinks, Tables, Forms and Frameworks

JavaScript: More Syntax

COMP519 Web Programming Lecture 11: JavaScript (Part 2) Handouts

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements

CSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures

Chapter 2: Functions and Control Structures

SCoLang - Language Reference Manual

do fifty two: Language Reference Manual

Angela Z: A Language that facilitate the Matrix wise operations Language Reference Manual

VLC : Language Reference Manual

CS201 Some Important Definitions

JavaScript Lecture 1

JavaScript CS 4640 Programming Languages for Web Applications

Array. Prepared By - Rifat Shahriyar

JavaScript CS 4640 Programming Languages for Web Applications

JavaScript I Language Basics

a data type is Types

CS242 COMPUTER PROGRAMMING

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 8/19/ Review. Here s a simple C++ program:

Lecture 2: Variables and Operators. AITI Nigeria Summer 2012 University of Lagos.

Examples. Object Orientated Analysis and Design. Benjamin Kenwright

Review of the C Programming Language for Principles of Operating Systems

A Small Interpreted Language

Arrays. Comp Sci 1570 Introduction to C++ Array basics. arrays. Arrays as parameters to functions. Sorting arrays. Random stuff

Common Misunderstandings from Exam 1 Material

JME Language Reference Manual

Chapter 2 Working with Data Types and Operators

BASIC ELEMENTS OF A COMPUTER PROGRAM

Control Structures. Lecture 4 COP 3014 Fall September 18, 2017

JAVASCRIPT. sarojpandey.com.np/iroz. JavaScript

Basic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable

SPARK-PL: Introduction

6.184 Lecture 4. Interpretation. Tweaked by Ben Vandiver Compiled by Mike Phillips Original material by Eric Grimson

Transcription:

JavaScript Syntax Web Authoring and Design Benjamin Kenwright

Milestone Dates Demonstrate Coursework 1 Friday (15 th December) 10 Minutes Each Coursework 2 (Group Project) Website (XMAS) Javascript Game (xmas theme) Team 2-3 People 29 th December (Friday) Demonstrate/Present Group Work

Group Names Let me know who your groups are 2-3 People

Outline Review Fundamental Syntax Javascript Summary Review/Discussion

Revision Question What will the following code print? a) 1 b) 10 c) 16 d) 31

c) 16 Answer

JavaScript Data Types

Primary Data Types (Primitive) String Number Boolean

Object Composite Data Types (reference) Array

Special Data Types Null Undefined

Overview of Types String : A strings of any characters enclosed in quotes is a string primitive. Number : A number by itself is a number primitive, all numbers in JavaScript are 64-bit floating-point numbers. Boolean : It will store Variables or expressions which are either true or false. Object: A collections of properties and methods. In Javascript, anything that is not a primitive is an Object. Arrays : Arrays are regular objects, both objects and arrays can have properties and methods. Null : It has only one value in JavaScript: null. Undefined : It treated as a variable that has been declared, but has never had a value assigned to it.

var anydata; Var in Javascript

Example var

Question Combining Data Types What would be in variable xyz?

Answer

Question What would be in variable xyz this time?

Answer

Scope of JavaScript Variables The Javascript variable has only two scopes, Global and Local. When you declare a variable within your function, its scope is local, that means you can use that variable only inside that function. If a variable declare outside the function, its scope is Global.

Constants Javascript you can define read-only Constant variables with const keyword

JavaScript keywords

Question How many Javascript keywords could you write down?

Question How many scope levels does Javascript have? a) one b) two c) three d) unlimited

Answer b) two The Javascript variable has only two scopes, Global and Local.

JavaScript Array Object

Constructors Already know the number of items that would store in an array, you can pass the number to the constructor of an Array Object Directly initialize the Array elements when declaring an Array Object

From 0... JavaScript array indexes start from 0 (zero) and continue as 1,2,3 etc..

Displaying Displaying Javascript Array elements You can display Array elements in several ways. The following methods will show all elements from an Array.

Javascript Array Length Length property of Javascript Array return the number of elements contains in an Array. Javascript Array index starts from 0 so the length of an array is equal to the last index + 1

Arrays Undefined Values Arrays are automatically growing and dynamically sized to accommodate any type of data that is added to them Add or remove elements from an array, the length of the array will change as needed Declare an Array with constructor, each slot will be set to "undefined"

Example

Other Array Methods Array.push() Array.contains() Array.sort() Array.splice() Array.slice() Array.join()

Conditional Statements

Alternative if..else Syntax (? Ternary Operator)

Switch Statements

Arithmetic Operators

Assignment Operators

Comparison Operators

Logical Operators AND (&&) : Allows you to check if both of two conditions are met OR ( ) : Allows you to check if one of two conditions are met NOT (!) : Allows you to check if something is not the case

Loops in JavaScript

Javascript for loop

Javascript for..in Loop

Javascript while Loop

Javascript do..while loop

Javascript Break statement

Continue statement

This Week Review Slides Read Associated Chapters Work through Javascript Examples Update GitHub Account/Webpage Start Group Project

Summary Overview of Javascript Syntax Examples Hands-On/Practical

Questions/Discussion

Learning JavaScript

Questions Next Week Questions to Investigate for Next Week

Question What order does f receive its arguments? a) foo bar baz b) foo baz bar c) bar foo baz d) foo baz

Question Which of the following is correct about the expression 1== 1.0 in Javascript? a) It returns false. The two values have different types. b) It returns true. The two values are converted to strings and are equal. c) It returns false. The two values are converted to strings and are not equal. d) It returns true. The two values are converted to numbers and are equal.

What arguments will fn receive, in order? a) b) c) d)