JavaScript: JS301 Week 1: An Introduction to JavaScript.

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

the javascript language BY SA.
Introducing JavaScript
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
1 COMM 1213 H1 COMP 4923 X1 JavaScript 1 (Readings: Ch. 10, 11 Knuckles)
Java Script Session1 INTRODUCTION.
Javascript Introduction Norman White Material is from w3schools.com Go there to run examples interactively.
Javascript It’s not JAVA. What do these all have in common?
Introduction to JavaScript Module 1 Client Side JS Programming M-GO Sponsored By
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Web Infrastructure Week 3 INFM 603. The Key Ideas Questions Structured Programming Modular Programming Data Structures Object-Oriented Programming.
Tutorial 10 Programming with JavaScript
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
© Anselm SpoerriInfo + Web Tech Course Information Technologies Info + Web Tech Course Anselm Spoerri PhD (MIT) Rutgers University
JavaScript CMPT 281. Outline Introduction to JavaScript Resources What is JavaScript? JavaScript in web pages.
JavaScript & jQuery the missing manual Chapter 11
Advanced Web Design Scripting Tutorial Chapters. Scripting Intro The scripting part of the forthcoming Advanced Web Design textbook introduces you to.
CISC474 - JavaScript 03/02/2011. Some Background… Great JavaScript Guides: –
Week 9 PHP Cookies and Session Introduction to JavaScript.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
1 JavaScript in Context. Server-Side Programming.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
Tutorial 10 Programming with JavaScript. XP Objectives Learn the history of JavaScript Create a script element Understand basic JavaScript syntax Write.
Tutorial 10 Programming with 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.
CHAPTER 4 Java Script อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
Using Client-Side Scripts to Enhance Web Applications 1.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
20-753: Fundamentals of Web Programming 1 Lecture 12: Javascript I Fundamentals of Web Programming Lecture 12: Introduction to Javascript.
Introduction.  The scripting language most often used for client-side web development.  Influenced by many programming languages, easier for nonprogrammers.
JavaScript Syntax and Semantics. Slide 2 Lecture Overview Core JavaScript Syntax (I will not review every nuance of the language)
JavaScript, jQuery, and Mashups Incorporating JavaScript, jQuery, and other Mashups into existing pages.
JS Basics 1 Lecture JavaScript - Basics. JS Basics 2 What is JavaScript JavaScript is a “simple”, interpreted, programming language with elementary object-
ALBERT WAVERING BOBBY SENG. Week 4: JavaScript  Quiz  Announcements/questions.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
1 JavaScript
05 – Java Script (1) Informatics Department Parahyangan Catholic University.
JavaScript Introduction.  JavaScript is a scripting language  A scripting language is a lightweight programming language  A JavaScript can be inserted.
XP Tutorial 10 Section 1 1 Programming with JavaScript.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
1 JavaScript in Context. Server-Side Programming.
1 Javascript CS , Spring What is Javascript ? Browser scripting language  Dynamic page creation  Interactive  Embedded into HTML pages.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Rich Internet Applications 2. Core JavaScript. The importance of JavaScript Many choices open to the developer for server-side Can choose server technology.
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
JQUERY AND AJAX
JavaScript and AJAX 2nd Edition Tutorial 1 Programming with JavaScript.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
JavaScript Tutorial First lecture 19/2/2016. Javascript is a dynamic computer programming language. It is lightweight and most commonly used as a part.
INTERNET APPLICATIONS CPIT405 JavaScript Instructor: Rasha AlOmari
>> Introduction to JavaScript
CSE 154 Lecture 11: AJAx.
Web Concepts Lesson 2 ITBS2203 E-Commerce for IT.
Tutorial 10 Programming with JavaScript
Nick Sims Scripting Languages.
JavaScript Syntax and Semantics
14 A Brief Look at JavaScript and jQuery.
CSE 154 Lecture 11: AJAx.
Web Development in Microsoft Visual Studio 2013
Web Systems Development (CSC-215)
CSE 154 Lecture 22: AJAX.
WEB PROGRAMMING JavaScript.
Tutorial 10 Programming with JavaScript
CS3220 Web and Internet Programming JavaScript Basics
Introduction to JavaScript
Intro to Programming (in JavaScript)
Presentation transcript:

JavaScript: JS301 Week 1: An Introduction to JavaScript

Introductions A little about your instructor A little about you Experience? Expectations?

Fuzzy Syllabus Intro and Basics Closures and Scope The Document Object Model (DOM) jQuery Object Oriented JavaScript Best Practices node.js? ajax? Windows 8?

What is JavaScript? JavaScript is a scripting language built into web browsers It is not Java - it is ECMAScript It powers web apps, mobile apps, server apps and desktop apps It is asynchronous, fast and powerful as hell JavaScript is fun!

No Server Required JavaScript can run on a server but most commonly runs on the client or browser Consoles in most browsers: Chrome JavaScript Console Firebug for Firefox Safari Error Console Internet Explorer Developer Tools

I’ll be Using Chrome Use any tool you like I can help you best if you use Chrome too

Great JavaScript Resources W3 Schools: YUI Theater: O’Reilly Books: JavaScript: The Definitive Guide JavaScript Patterns

Getting to the Console In Chrome right click and choose “Inspect Element”, then go to the Console tab. Type: document.write(“Hello World”); Then press enter

What just Happened? In web browsers, document is an object which represents the current HTML document. It has a method called write which writes content to the HTML document. We invoked that method with the text we wanted to write as a parameter. The method returned the value ‘undefined’.

How to break it Try these variations: Document.write("Hello World"); document.write('Hello World'); document.write("Hello World") {document.write("Hello World");}

Variables Variables hold values: This also sends “Hello World” to the browser. Variable assignments return the assignment value. > greeting = "Hello World"; "Hello World" > document.write(greeting); undefined

Operators You can perform operations on variables: What other operations do you think you could apply to variables? > apples = "Apples"; "Apples" > bananas = "Bananas"; "Bananas" > ilike = apples + " & " + bananas; "Apples & Bananas"

Types Variables have types: Number: > one = 1; 1 > two = 2; 2 > one + two 3 String: > one = "1"; "1" > two = "2"; "2" > one + two "12" Boolean: > yup = true; true > nope = false; false > 5 < 2; false > !nope true

Arrays Array literals: > fibonacci = [0,1,1,2,3,5,8,13]; [0, 1, 1, 2, 3, 5, 8, 13] > fibonacci.push(21); 9 > fibonacci [0, 1, 1, 2, 3, 5, 8, 13, 21] > fibonacci.length; 9 > fibonacci[2]; 1 > fibonacci[6]; 8

Objects Object Literals: > Rectangle = { width: 10, height: 5 }; ▶ Object > rectangle.height 5 > rectangle.length undefined

More Types Functions Undefined More on these later.

if conditional > age = 13; 13 > if (age >= 16) console.log("Old enough to vote!"); undefined > age = 25; 25 > if (age >= 16) console.log("Old enough to vote!"); Old enough to vote! undefined

if conditional > age = 15; 15 > if ((age > 12) && (age < 20)) console.log("Teen"); Teen undefined > if ((age > 12) && (age < 20)) { console.log("Teen"); } Teen undefined

if conditional > age = 15; 15 > if (age >= 16) { console.log("Old enough to drive"); } else { console.log("Old enough in " + (16 - age) + " year(s)"); } Old enough in 1 year(s) undefined

JSFIDDLE We’re outgrowing the JavaScript console! JSFIDDLE is another great way to play with JavaScript. Check out the next demo there:

Loops: for For loops are the most common type of loop in JavaScript: for (i = 1; i <=10; i++) { document.write(" " + i + " "); }

Loops: while While loops run until a condition is met i = 1; while (i <=10) { document.write(" " + i + " "); i += 1; }

Loops: break & continue Break jumps out of a loop Continue jumps back to the start of the loop

Loops: for.. in Loops over the items in an array or object

Functions Functions group code into re-usable chunks Can take parameters Can return values

Exception Handling Instead of returning error codes you can “throw” errors up the call stack to error handlers

Next Week... Advanced Functions and Closures Variable Scope The Document Object Model jQuery