Programming Control Structures with JavaScript

Slides:



Advertisements
Similar presentations
Decision Structures - If / Else If / Else. Decisions Often we need to make decisions based on information that we receive. Often we need to make decisions.
Advertisements

Chapter 4: Control Structures I (Selection)
Chapter 13 Control Structures. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display Control Structures Conditional.
ALGORITHMS - PART 2 CONDITIONAL BRANCH CONTROL STRUCTURE
PHP Conditions MIS 3501, Fall 2014 Jeremy Shafer Department of MIS Fox School of Business Temple University September 11, 2014.
If Statements Sections 1.25, Control Structures o All code thus far executes every line of code sequentially o We want to be able to repeat,
Tutorial 4 Decision Making with Control Structures and Statements Section A - Decision Making JavaScript Tutorial 4 -Decision Making with Control.
Chapter 61 More about Loop Do ….. Loop Write Down “Do” and “Loop”
Decision Structures and Boolean Logic
Python – Making Decisions Lecture 02. Control Structures A program that only has one flow is useful but limited. We can use if statements to make these.
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
1. We’ve learned that our programs are read by the compiler in order, from top to bottom, just as they are written The order of statement execution is.
Lesson 5: Working with Formulas and Functions Logical and 3D Formulas.
CHAPTER 4: Selection Control Structure. Objectives  Use the relational comparison operators  Learn about AND logic  Learn about OR logic  Make selections.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
Conditional Expression One of the most useful tools for processing information in an event procedure is a conditional expression. A conditional expression.
Lecture 2 Conditional Statement. chcslonline.org Conditional Statements in PHP Conditional Statements are used for decision making. Different actions.
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
Chapter 2 Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc.Slide 1.
Chapter 7: The Repetition Structure Introduction to Programming with C++ Fourth Edition.
Conditional statements and boolean expressions Arithmetic, relational and logical operators.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Class02 More Arrays MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 1/14/2016.
USING CONDITIONAL CODE AMIR KHANZADA. Conditional Statement  Conditional statements are the set of commands used to perform different actions based on.
Conditional Statements A conditional statement lets us choose which statement will be executed next Conditional statements give us the power to make basic.
IST 210: PHP Logic IST 210: Organization of Data IST2101.
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
© 2016, Mike Murach & Associates, Inc.
Chapter 2 Section 2 Absolute Value
Sequence, Selection, Iteration The IF Statement
PHP: includes MIS 3501 Jeremy Shafer Department of MIS
jQuery – Form Validation
Operator Precedence Operators Precedence Parentheses () unary
Topics The if Statement The if-else Statement Comparing Strings
JavaScript Create Array object
A computer program is a sequence of computer commands.
Chapter 19 JavaScript.
Introduction to JavaScript
JavaScript Selection Statement Creating Array
Topics The if Statement The if-else Statement Comparing Strings
A second look at JavaScript
Computers & Programming Languages
Class07 PHP: loops MIS 3501 Jeremy Shafer Department of MIS
Chapter 8: More on the Repetition Structure
MySQL Backup, Transfer and Restore
Visual Basic – Decision Statements
HTML5 APIs MIS3502 Jeremy Shafer Department of MIS
PDO Revisited MIS 3502 Jeremy Shafer Department of MIS
If Statements.
JavaScript and the DOM MIS 2402 Jeremy Shafer Department of MIS
Numbers, strings and dates in JavaScript
MIS JavaScript and API Workshop (Part 2)
An Introduction to JavaScript
Programming Control Structures with JavaScript Part 2
Conditional Statements with JavaScript
Loops and Arrays in JavaScript
JavaScript objects, functions, and events
Introduction to JavaScript
Relational Operators.
Chapter 4: Boolean Expressions, Making Decisions, and Disk Input and Output Prof. Salim Arfaoui.
MVC – Model View Controller
PDO and Arrays MIS 3502 Jeremy Shafer Department of MIS
The Selection Structure
Chapter 3: Selection Structures: Making Decisions
A3 2.1d To Solve Compound Inequalities
Strings and Dates in JavaScript
If / Else Statements.
Flow of Control Flow of control is the order in which a program performs actions. Up to this point, the order has been sequential. A branching statement.
Murach's JavaScript and jQuery (3rd Ed.)
Logial Operators & Conditional Logic
Presentation transcript:

Programming Control Structures with JavaScript MIS 2402 Jeremy Shafer Department of MIS Fox School of Business Temple University

Let’s talk about… Chapter 3 What is the difference between assignment and comparison operators? What are some control structures that use comparisons? How is programming like a sandwich?

Agenda Using breakpoints the Chrome Developer Tools Conditional Expressions Putting conditional expressions to work: If statements

Breakpoints Setting one or more breakpoints in your code will allow you, the developer, to get a better understanding of how your code is working. Let’s see an example of this. (see rocket.zip)

The relational operators We use these operators to compare values

Conditional expressions Expressions evaluate to true or false. What do each of these expressions evaluate to?

Another test The syntax of the global isNaN method isNaN() is a global method. The term “global” means it is available everywhere in your JavaScript code. Global methods are also sometimes called functions.

The logical operators

Conditional expressions with logical operatiors Expressions evaluate to true or false. What do each of these expressions evaluate to? So – what does this evaluate to: !(1 == 2) && 'monkey' == 'monkey' || 'elephant' == 'hippo'

Putting conditional expressions to work! The syntax of the if statement

An if statement with multiple else clauses

Let’s give this a try…