We are starting JavaScript. Here are a set of examples

Slides:



Advertisements
Similar presentations
A Level Computing#BristolMet Session Objectives#U2 S2 MUST describe the steps of an algorithm using a program flowchart SHOULD explain the data types and.
Advertisements

1 COMM 1213 H1 COMP 4923 X1 JavaScript 1 (Readings: Ch. 10, 11 Knuckles)
JavaScript Functions Please use speaker notes for additional information!
Lesson 4: Formatting Input Data for Arithmetic
Introduction to JavaScript Please see speaker notes for additional information!
JavaScript with Input & Output Step 1: Use tags JavaScript Template.
Introduction to scripting
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
Topic: An Introduction to JavaScript - from Beginning JavaScript by Wilton (WROX)
Introducing JavaScript. Goals By the end of this lecture you should … Be able to describe the differences among object methods, object properties and.
Writing JavaScript Functions. Goals By the end of this unit, you should understand … How to breakdown applications into individual, re-usable modules.
Variables When programming it is often necessary to store a value for use later on in the program. A variable is a label given to a location in memory.
Input & Output Functions JavaScript is special from other languages because it can accept input and produce output on the basis of that input in the same.
Variables and Data Types Data (information we're going to store) – Numbers – Text – Dates What types of data can JavaScript process? How do we store it?
ITEC 109 Lecture 7 Operations. Review Variables / Methods Functions Assignments –Purpose? –What provides the data? –What stores the data? –What type of.
1 Chapter 3 – JavaScript Outline Introduction Flowcharts Control Structures if Selection Structure if/else Selection Structure while Repetition Structure.
JavaScript Assignment Statements Expressions Global Functions CST 200 JavaScript.
Pay Example (PFirst98) Please use speaker notes for additional information!
JavaScript Challenges Answers for challenges
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Answer questions about assignment.. Starting JavaScript, at my site these examples are under programs and JavaScript. You can see the address for this.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
INTERNET APPLICATIONS CPIT405 JavaScript Instructor: Rasha AlOmari
JavaScript: Control Structures I Outline 1 Introduction 2 Algorithms 3 Pseudocode 4 Control Structures 5 if Selection Structure 6 if/else Selection Structure.
Input, Output and Variables GCSE Computer Science – Python.
CSS Colors, JavaScript Variables, Conditionals and Basic Methods
2.5 Another Java Application: Adding Integers
Variables, Expressions, and IO
Click here for the answer. Click here for the answer.
Click here for the answer. Click here for the answer.
Click here for the answer. Click here for the answer.
While Loops (Iteration 2)
Please use speaker notes for additional information!
Chapter 7 - JavaScript: Introduction to Scripting
Please use speaker notes for additional information!
JavaScript: Introduction to Scripting
WEB PROGRAMMING JavaScript.
We are starting to program with JavaScript
Using SQL with Access I am adding queries to the stu table in SecondDB.accdb – a database that I created in class. SQL stands for structured query language.
T. Jumana Abu Shmais – AOU - Riyadh
On new..
Variables and Expressions
Variables Kevin Harville.
Core Objects, Variables, Input, and Output
An Introduction to JavaScript
Note the rights settings.
The + can mean concatenate or add
JavaScript.
For this assignment, copy and past the XHTML to a notepad file with the .html extension. Then add the code I ask for to complete the problems.
Using screens and adding two numbers - addda.cbl
Notes on SQL This slide show will introduce SQL using Access. It assumes only an introductory level of knowledge about Access.
7 – Variables, Input and Output
Java Programming with BlueJ Objectives
Introducing JavaScript
JavaScript: Introduction to Scripting
Other types of variables
Chapter 7 - JavaScript: Introduction to Scripting
Basic Lessons 5 & 6 Mr. Kalmes.
Chapter 7 - JavaScript: Introduction to Scripting
Data Types and Maths Programming Guides.
Basic Mr. Husch.
Input, Variables, and Mathematical Expressions
Values and Variables.
This is an introduction to JavaScript using the examples found at the CIS17 website. In previous examples I specified language = Javascript, instead of.
Basic program gives only one quess and then the program ends.
Murach's JavaScript and jQuery (3rd Ed.)
Working with Numbers parseInt() and parseFloat() Math.round()
Chapter 7 - JavaScript: Introduction to Scripting
Python Creating a calculator.
Presentation transcript:

We are starting JavaScript. Here are a set of examples We are starting JavaScript. Here are a set of examples. Remember that after you click on them and open them you can use view source to see the code.

The first program writes on the document and also brings up a pop up that says Hello World!

Note the semi-colon at the end of each line.

This is another program where I am bringing up a prompt to ask the user for input. Notice the mesage in the prompt that says Enter the first number. There was a default 0 in the box, I entered a 3 so that is what you are seeing.

First I define three memory variables. the default of 0 went into the box on the prompt where the user can input a response. I entered a 3 and a 4 so the result in ans is 12.

It writes the literal followed by the content of ans.

it concatenates the 3 and the 4 I entered and shows 34 it concatenates the 3 and the 4 I entered and shows 34. If I convert firstnum to a number using either parseFloat (which produces a floating number that can have decimals) or parseInt (which produces an integer number). Then I convert secondnum. Since JavaScript now knows they are numbers, it does the add and I see the answer of 7. the parenthesis. This should say parseInt.

Notice that the things I want to do if the if is true are within { } and the things I want to do with the else are also within { }. I do not need an end if because I have contained the processes this way.

After I calculate ans, I write it outside the if.

This flowchart shows the change I want to make so it checks for a / and if it is not a / it assigns 0 to ans.

I entered a + and so 0 was assigned to ans.