JavaScript: The First Parts Part One Douglas Crockford Yahoo! Inc.

Slides:



Advertisements
Similar presentations
Chapter 22 Implementing lists: linked implementations.
Advertisements

JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Chapter 6 Type Checking. The compiler should report an error if an operator is applied to an incompatible operand. Type checking can be performed without.
Adapted from John Zelle’s Book Slides
Python Programming: An Introduction to Computer Science
Introduction to C Programming
Advanced JS The World's Most Misunderstood Programming Language ) Douglas Crockford( Shimon Dahan
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Mathematical Operators  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course. Introduction to Computers and Programming in.
Program Design and Development
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
ECE122 L3: Expression Evaluation February 6, 2007 ECE 122 Engineering Problem Solving with Java Lecture 3 Expression Evaluation and Program Interaction.
Basic Building Blocks of Programming. Variables and Assignment Think of a variable as an empty container Assignment symbol (=) means putting a value into.
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, Third Edition
COMP1170 Midterm Preparation (March 17 th 2009) Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education.
Introduction to C Programming
1 Lecture 3  Lexical elements  Some operators:  /, %, =, +=, ++, --  precedence and associativity  #define  Readings: Chapter 2 Section 1 to 10.
Programming Concepts MIT - AITI. Variables l A variable is a name associated with a piece of data l Variables allow you to store and manipulate data in.
C Programming. Chapter – 1 Introduction Study Book for one month – 25% Learning rate Use Compiler for one month – 60%
Imperative Programming Part One. 2 Overview Outline the characteristics of imperative languages Discuss other features of imperative languages that are.
CIS Computer Programming Logic
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
Python Programming, 2/e1 Python Programming: An Introduction to Computer Science Chapter 2.
CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad GM-IT CIIT Islamabad CIIT Virtual Campus, CIIT COMSATS Institute.
2440: 211 Interactive Web Programming Expressions & Operators.
Chapter 3: Data Types and Operators JavaScript - Introductory.
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 Session 2: What is JavaScript?
CompSci Today’s topics Java Review Just a bunch of headings meant to trigger questions A contraction of previous notes Upcoming Midterm Exam Reading.
1 © 2002, Cisco Systems, Inc. All rights reserved. Arrays Chapter 7.
1 Functions Lecfture Abstraction abstraction is the process of ignoring minutiae and focusing on the big picture in modern life, we are constantly.
Computers and Scientific Thinking David Reed, Creighton University Functions and Libraries 1.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
1 Building Java Programs Chapter 7: Arrays These lecture notes are copyright (C) Marty Stepp and Stuart Reges, They may not be rehosted, sold, or.
THINKING BIG Abstraction and Functions chapter 6 Modified by Dr. Paul Mullins for CPSC 130, F05.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
JavaScript, Fourth Edition
JavaScript: The First Parts Part Three Douglas Crockford Yahoo! Inc.
Variables and Assignment CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Loops Robin Burke IT 130. Outline Announcement: Homework #6 Conditionals (review) Iteration while loop while with counter for loops.
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
XP New Perspectives on XML, 2 nd Edition Tutorial 7 1 TUTORIAL 7 CREATING A COMPUTATIONAL STYLESHEET.
Data And Variables Chapter Names vs. Values Michael Jordan name (the letter sequence used to refer to something) value (the thing itself)
Part:2.  Keywords are words with special meaning in JavaScript  Keyword var ◦ Used to declare the names of variables ◦ A variable is a location in the.
XP 1 XSLT II Robin Burke ECT 360. XP 2 Outline Conditionals Numbering Functions and operators Variables and parameters Named and recursive templates.
PHP Programming with MySQL Slide 3-1 CHAPTER 3 Working with Data Types and Operators.
Chapter 2 Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc.Slide 1.
XP 1 XSLT II Robin Burke ECT 360. XP 2 Homework #4 Forgot we hadn't covered "choose" becomes extra credit My books.xml didn't include descriptions.
JavaScript: The First Parts Part Two Douglas Crockford Yahoo! Inc.
Chapter 14 JavaScript: Part II The Web Warrior Guide to Web Design Technologies.
JavaScript Functions. CSS Inheritance Which formatting applies? x y z input { display: block; } input.pref { background:red; } If you have a selector.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
MIT-AITI: Functions Defining and Invoking Functions Functions as Data Function Scope: The call Object Function Arguments: The arguments objects Function.
Chapter 2: Data and Expressions. Variable Declaration In Java when you declare a variable, you must also declare the type of information it will hold.
Chapter 5 Murach's JavaScript and jQuery, C1© 2012, Mike Murach & Associates, Inc.Slide 1.
JavaScript Tutorial. What is JavaScript JavaScript is the programming language of HTML and the Web Programming makes computers do what you want them to.
Introduction C# program is collection of classes Classes are collection of methods and some statements That statements contains tokens C# includes five.
Chapter 3: Variables, Functions, Math, and Strings
Chapter 3: Variables, Functions, Math, and Strings
The relational operators
© Akhilesh Bajaj, All rights reserved.
PHP.
Tutorial 10: Programming with javascript
Building Java Programs
Presentation transcript:

JavaScript: The First Parts Part One Douglas Crockford Yahoo! Inc.

Learn to Program Values Variables Expressions Branching Loops Functions Recursion Arrays Objects Trees

Why should you learn to program?

In programming we construct and maintain extremely complex systems with aspirations of perfection.

Ulterior Motives

Programming Languages

JavaScript The world's most misunderstood programming language.

Learn to Program Values Variables Expressions Branching Loops Functions Recursion Arrays Objects Trees

Values Numbers, strings, booleans null undefined

Variables Values stored under names. The values can be replaced.

Expressions Elements of computation

Branching Alter the sequential flow of the program

Loops Repetitive operations

Functions Encapsulated expressions

Recursion Functions defined in terms of themselves

Arrays Linear sequences of storage

Objects Associative collections of named values

Trees Complex structures composed of objects

Inside every programming language there is a calculator Literal numbers with infix operators * used for multiplication / is used for division Precedence ( ) can change precedence * 4 === 14 (2 + 3) * 4 === 20

The Yellow Box

Try these / 0 JavaScript numbers don't always work like real numbers.

The result of an expression can be stored in a variable a = 3 + 4

a = a + 1

The naming of variables is a serious matter It isn't just one of your holiday games. Well chosen names can make a program self descriptive. A variable name should begin with a letter. It can contain any number of letters and digits. It can contain the _ (underline) character.

Functions Functions can encapsulate an expression. Functions can be stored in variables. Functions may have parameters. Functions can be invoked. Functions can grow the language.

function ( parameter ) { return expression ; } double = function (number) { return number * 2;} double(212)

function ( parameter ) { return expression ; } celsius = function (f) { return (f - 32) * 5 / 9;} boiling_point = celsius(212)

function ( parameter ) { return expression ; } quad = function (x) { return double(x) + double(x);} average = function (a, b) { return (a + b) / 2; }

Functions A function can take many parameters, or no parameters. If it takes more than one parameter, the parameter names are separated with commas. A parameter name is like a variable inside the function. When a function is called, the argument values are assigned to the parameters.

Assignment One 1.Read Preface, Chapter One of The Good Parts 2.Write function fahrenheit(c) 3.Write a function of your own that takes two or more parameters. 4.Using trial and error, determine the temperature such that fahrenheit(x) === celsius(x) Put your answers in a text or html file and add it to Use your unique ID in the name of the file.