Intro to Programming and JavaScript. What is Programming? Programming is the activity of creating a set of detailed instructions (Program) that when carried.

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

08/2012Tanya Mishra1 EASYC for VEX Cortex Llano Estacado RoboRaiders FRC Team 1817.
* Programming is the activity of creating a set of detailed instructions (program) that when carried out on a consistent set of inputs will result in.
ISP 121 Algorithmsand Computer Programming. Why Know Simple Programming?  You can create powerful macros in Access / Excel / Word / ??? to manipulate.
Programming TBE 540 Farah Fisher. Objectives After viewing this presentation, the learner will be able to… Given a task, create pseudocode Given pseudocode,
Programming in Visual Basic
 2005 Pearson Education, Inc. All rights reserved Introduction.
JavaScript 101 Lesson 01: Writing Your First JavaScript.
1 Outline 13.1Introduction 13.2A Simple Program: Printing a Line of Text in a Web Page 13.3Another JavaScript Program: Adding Integers 13.4Memory Concepts.
CS31: Introduction to Computer Science I Discussion 1A 4/2/2010 Sungwon Yang
CIS101 Introduction to Computing Week 11. Agenda Your questions Copy and Paste Assignment Practice Test JavaScript: Functions and Selection Lesson 06,
CIS101 Introduction to Computing Week 09. Agenda Hand in Resume project Your questions Introduction to JavaScript This week online Next class.
Introduction to a Programming Environment
The Information School of the University of Washington Oct 20fit programming1 Programming Basics INFO/CSE 100, Fall 2006 Fluency in Information Technology.
CIS101 Introduction to Computing Week 12 Spring 2004.
CIS101 Introduction to Computing Week 09 Spring 2004.
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
Introduction to JavaScript for Python Programmers
CS102 Introduction to Computer Programming
Programming Games Computer science big ideas. Computer Science jargon. Show virtual dog Homework: [Catch up: dice game, credit card or other form.] Plan.
Chapter 9 Interactive Multimedia Authoring with Flash - Introduction to Programming “Computers and Creativity” Richard D. Webster, COSC 109 Instructor.
Javascript and the Web Whys and Hows of Javascript.
Adding JavaScript (<script tag>)
CS346 - Javascript 1, 21 Module 1 Introduction to JavaScript CS346.
Javascript and Basic Programming Concepts. What is a Program? A program is a specific set of instructions written in a computer language to perform a.
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.
Introduction to Python
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
THE BIG PICTURE. How does JavaScript interact with the browser?
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Chapter 4 JavaScript and Dynamic Web pages. Objectives Static Web pages Dynamic Web pages JavaScript Variables Assignments. JavaScript Functions –(prompt(“”,””)
Objective Static vs. Dynamic Web pages. Variables. Assignments. JavaScript Hierarchy of Objects JavaScript Functions (prompt(“”,””) Document.write(“”)
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Dynamic Web Pages & JavaScript. Dynamic Web Pages Dynamic = Change Dynamic Web Pages are web pages that change. More than just moving graphics around.
1 Chapter 18 Programming Basics When it comes to being precise about an algorithm, a programming language is better than English.
Logic and Control. 4-2 Decision (selection) structure: if (condition) { statement etc. } Example: if (age == 15) { document.write(“ you are a fifteen”);
Overview of Form and Javascript fundamentals. Brief matching exercise 1. This is the software that allows a user to access and view HTML documents 2.
1 A Balanced Introduction to Computer Science David Reed, Creighton University ©2005 Pearson Prentice Hall ISBN X Chapter 4 JavaScript and.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
 2000 Deitel & Associates, Inc. All rights reserved. Outline 8.1Introduction 8.2A Simple Program: Printing a Line of Text in a Web Page 8.3Another JavaScript.
LECTURE#2 INTRODUCTION TO COMPUTERS, HISTORY AND APPLICATIONS INSTRUCTOR: M. MATEEN YAQOOB.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Fluency with Information Technology Third Edition by Lawrence Snyder Chapter.
1 JavaScript and Dynamic Web Pages Lecture 7. 2 Static vs. Dynamic Pages  A Web page uses HTML tags to identify page content and formatting information.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Algorithms, problem solving and Introduction to C++
>> Introduction to JavaScript
Algorithms, problem solving and Introduction to C++
Computer Programming (BCT 1113)
Programming Mehdi Bukhari.
JavaScript.
Chapter 10 Programming Fundamentals with JavaScript
Introduction to JavaScript for Python Programmers
Lesson 2: Input and Variables
INFO/CSE 100, Spring 2005 Fluency in Information Technology
T. Jumana Abu Shmais – AOU - Riyadh
JavaScript What is JavaScript? What can JavaScript do?
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
CS105 Introduction to Computer Concepts
High Level Programming Languages
JavaScript What is JavaScript? What can JavaScript do?
Tutorial 10: Programming with javascript
Web Programming– UFCFB Lecture 13
design OO words Debug Variables Data types
CS105 Introduction to Computer Concepts JavaScript
Intro to Programming (in JavaScript)
Presentation transcript:

Intro to Programming and JavaScript

What is Programming? Programming is the activity of creating a set of detailed instructions (Program) that when carried out on a consistent set of inputs will result in a consistent set of results. Programming has been around for several hundred years

History of Programming 1206 AD – Kurdish medieval scientist built a programmable automata – Used pegs and cams in different places that would trigger levers to produce a small drummer playing different rhythms and drum patterns. (Music Box) Jacquard Loom, pasteboard cards with holes punched in them which told the loom the pattern to weave the cloth

History of Programming 1830 – Charles Babbage adopted punch cards to control his Analytical Engine 1954 – FORTRAN is invented. Allowed user to enter in calculations by a formula directly (Y = X*2 + 5*X + 9) – Used a compiler to translate the text into machine language

History of Programming Late 1960’s – data storage and computer terminals were cheap enough that programs could be made directly on computers – Text editors could be used to program (Komodo) Popular programming languages: ActionScript, C++, C#, Haskell, HTML with PHP, Java, JavaScript, Objective-C, Perl, Python, Ruby, Smalltalk, SQL, Visual Basic, and dozens more.

Programming Lifecycle Requirements – Documenting the specifications of the problem Design – Creating the Algorithm to solve the problem Coding – Translating the Algorithm into instructions the computer can understand – Program Testing – Exercising the Program to ensure the expected results are achieved Debugging – If the expected results are not achieved; correcting the Algorithm or Program to address the “bugs” Retesting – Repeating all the testing to ensure the changes solved the problem(s) and didn’t create new problems Publishing – Making the Program available to the users

STOP Show programs

Algorithms and Pseudocode Algorithm – Detailed instructions for solving a problem Pseudocode – English like statements mixed with code statements for describing an algorithm

JavaScript Used mostly in web browsers Interaction with the user Control Alter content

Some JavaScript Examples html html

First JavaScript Command document.write(“Stuff goes in here.”); Needs to go in between document.write(“Stuff goes in here”); The above needs to go in the body.

First JavaScript Command cont. All JavaScript commands end with a semicolon You can put HTML into the JavaScript command: document.write(“ HTML from JavaScript ”);

Finding the Length of Words document.write(“This sentence has five e’s”.length); document.write(“Short word”.length); document.write(“Four”.length)

JavaScript Math! You can use JavaScript to do Math! document.write(3+4); document.write(3*4); document.write(3/4); Can write out a Math equation: document.write(“3+4=”, 3+4); Can multiply numbers with length of words: document.write(“Test”.length*10 );

JavaScript Communication You can talk to the user! confirm(“Today is a good day!”); confirm(“I am Batman”); You can ask for information: prompt(“What is your name?”); prompt(“What is your quest?”); prompt(“What is your favorite color?”);

JavaScript Data Types 1.Numbers: 3, 2.5, -1000, , etc. You can do math with them! 2.Strings: sequence of characters (words) in quotes “This is a string.” “Strings can also have numbers like 5 or symbols.”

JavaScript Data Types cont. Boolean: only take values true or false Statements can evaluate to true or false Examples: – 100 > 10 – 8 < 3 – 10.4 < 30 – “Test”.length < 2

JavaScript Comparisons > : Greater than < : Less than <= : Less than or equal to >= : Greater than or equal to === : Equal to !== : Not equal to

Practice Make these true: – document.write(20 10); – document.write(“John Smith”.length 100); – document.write(“USA” 3);

Conditionals Using Comparisons and Conditionals, computers can now make decisions if (100 > 2) { document.write(“That is correct!”); }

2 Decisions – If, else if (100 > 2) { document.write(“That is correct!”); } else { document.write(“That is incorrect.”); }

If and Else if (100 > 2) { document.write(“That is correct!”); } else { document.write(“That is incorrect.”); }

Any Type of Comparison in If/Else if (50/2 === “My Word”.length) { confirm(“Will the first block be displayed?”); } else { confirm(“Or the second block?”); }

Variables Variables are like “boxes” or “containers” that can hold data (strings, numbers, booleans) Declaring some variables: var varName = “String variable”; var myAge = 23; var myName = “Matt”; var myBool = true;

Some Variable Rules Variables can be letters and numbers: – No spaces or punctuation except underscores – When used, need to be spelled exactly Variables need to be declared once: var myVar = “Test variable”; myVar = “Changing test variable”;

Variables Can Save Data to be Used Later var test1 = confirm(“Yes or no?”); var test2 = prompt(“What is your favorite color?”); document.write(“You said: ”, test1, “ ”); document.write(“Your favorite color is: ”, test2, “ ”);

Using Conditionals, Variables, and User Input var myAge = prompt(“How old are you?”); if(myAge >= 18) { document.write(“Welcome to rated R movie.”); } else { document.write(“You cannot watch the rated R movie.”); }