Javascript. UNIVERSITY OF MASSACHUSETTS AMHERST CMPSCI 120 Fall 2010
|
|
- Flora Copeland
- 6 years ago
- Views:
Transcription
1 Lecture 14 Javascript Announcements Project #2 New website Exam#2 No. Class Date Subject and Handout(s) 17 11/4/10 Examination Review Practice Exam PDF 18 11/9/10 Search, Safety, Security Slides PDF UMass Thursday: Examination #2 Tentative 19 11/10/10 (covers Lec.11-16), location TBD 1
2 JavaScript Java real name is ECMAScript is reasonably platform-independent a complete, full-featured, complex language most popular scripting language scripting languages are lightweight PL seldom used to write complete programs used to add functionality to HTML pages JavaScript often embedded directly into HTML pages but most scripts should be loaded from an external file is an interpreted language scripts execute without preliminary compilation 2
3 Using JavaScript in a browser JavaScript code is included within <script> tags: <script type="text/javascript"> document.write("<h1>hello World!</h1>"); </script> This simple code does the same thing as just putting <h1>hello World!</h1> in the same place in the HTML document Using JavaScript in a browser <script type="text/javascript"> document.write("<h1>hello World!</h1>"); </script> type attribute is to allow you to use other scripting languages but JavaScript is the default semicolon at the end of the JavaScript statement is optional need semicolons if you put 2 + statements on the same line always a good idea to use semicolons 3
4 More examples <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " <html xmlns=" <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>java Script Example</title> <html> <body> <script type="text/javascript"> document.write("<h1>this is a header</h1>"); </script> </body> </html> JavaScript Comments Comments can be added to explain the JavaScript, or to make it more readable. Single line comments start with //. This example uses single line comments to explain the code: <script type="text/javascript"> // This will write a header: document.write("<h1>this is a header</h1>"); // This will write two paragraphs: document.write("<p>this is a paragraph</p>"); document.write("<p>this is another paragraph</p>"); </script> 4
5 Handling old browsers Use html comment that JavaScript will interpret as JavaScript comment <html> <body> <script type="text/javascript"> <!-- Rest of line ignored by (x)html interpreter document.write("hello World!"); //--> </script> </body> </html> Some users turn off JavaScript Use the <noscript>message</noscript> to display a message in place of whatever the JavaScript would put there Where to put JavaScript JavaScript functions can (should) be put in a separate.js file Put this in the <head> <script src="myjavascriptfile.js"></script> An external.js file lets you use the same JavaScript on multiple HTML pages The external.js file cannot itself contain a <script> tag 5
6 Where to put JavaScript JavaScript can be put in the <head> or in the <body> of an HTML document JavaScript functions should be defined in the <head> This ensures that the function is loaded before it is needed JavaScript in the <body> will be executed as the page loads JavaScript can be put in an HTML form object, such as a button This JavaScript will be executed when the form object is used Locating JavaScript Scripts in the head section: <html> <head> <script type="text/javascript">... </script> </head> Scripts in the body section: <html> <head> </head> <body> <script type="text/javascript">... </script> </body> 6
7 Locating JavaScript Scripts in both the body and the head section: <html> <head> <script type="text/javascript">... </script> </head> <body> <script type="text/javascript">... </script> </body> Using an External JavaScript <html> <head> JavaScripts in the body section will be executed WHILE the page loads. JavaScripts in the head section will be executed when CALLED <script type="text/javascript" src="xxx.js"></script> </head> <body> </body> </html> Note: The external script cannot contain the <script> tag! More examples JavaScript Blocks JavaScript statements can be grouped together in blocks. Blocks start with a left curly bracket {, and ends with a right curly bracket }. The purpose of a block is to make the sequence of statements execute together. 7
8 More examples Example write a header and two paragraphs to a web page: <script type="text/javascript"> { document.write("<h1>this is a header</h1>"); document.write("<p>this is a paragraph</p>"); document.write("<p>this is another paragraph</p>"); } </script> Programming overview What is programming? process of creating a set of instructions for the computer to follow instructions are written in a language or languages which people can understand "compiled" (literally, translated) into machine language interpreted by the computer from reading a script. HTML is a programming language, as are Javascript and VBScript ASP Programming Fundamentals by Kevin Spencer
9 Programming overview What is programming? "syntax" of a programming language consists of the various language elements, conventions, and operators that are used to write the instructions. Procedural vs. Object-Oriented Programming Procedural Prrogramming was first Computer is given a set of instructions which it executes, and then waits for input, which it reacts to by executing another set of instructions, and so on ASP Programming Fundamentals by Kevin Spencer 2005 Procedural Programming 3 basic elements Sequence order in which instructions are executed more important than it might seem having things in the proper sequence is essential. Selection If/else conditional statements and other forms of selection how a program makes and reacts to choices. Iteration use of "loops" and other forms of repetitive sets of instructions ASP Programming Fundamentals by Kevin Spencer
10 Object Oriented Programming Came along with the advent of multi-tasking operating systems such as, PARC Alto, Mac, Windows Procedural programming is at the heart of all programming, including object-oriented programming Objects have properties, methods, and event handlers. ASP Programming Fundamentals by Kevin Spencer 2005 Properties, methods, and events Properties the characteristics define how the object behaves a web page has certain properties, which are defined in the HTML & CSS tags, such as the background color, style source page, etc. Methods blocks of instructions that can be executed by an object each object has its own set of methods. ASP Programming Fundamentals by Kevin Spencer
11 Properties, methods, and events Event Handlers an "event" is when something happens either something that the user has done, or something the program itself has done, or another program has done. event handlers are designed to react to events each object has its own event handlers ASP Programming Fundamentals by Kevin Spencer 2005 Procedure-oriented programming focus on functions and procedures that operate on data large programs divided in smaller units data and functions treated as separate entities top-down design 11
12 Object-oriented programming emphasis on data code is divided into objects both data and functions integrated properties, data hidden and accessed only by internal methods via interface bottom-up design Document Object Model (DOM) 12
13 Document Object Model (DOM) An application programming interface (API) for HTML and XML documents defines the logical structure of documents and the way a document is accessed and manipulated programmers can build documents, navigate their structure, and add, modify, or delete elements and content Document Object Model (DOM) Anything found in an HTML or XML document can be accessed, changed, deleted, or added using the Document Object Model, with a few exceptions The DOM originated as a specification to allow JavaScript scripts and Java programs to be portable among Web browsers 13
14 Variables Provide temporary storage for information that will be needed by program or application Transfer information from one part of the program to another Variable naming rules: upper and lower case letters, underscores, and dollar signs numbers are allowed after the first character no other characters are allowed 14
15 Variables Variables are declared with a var statement: var pi = , x, y, name = "Dr. Dave" ; Variable names are case-sensitive Month, month are different Variables names must begin with a letter or underscore _month, month but not 2months avoid reserved words Reserved words Some words have a special meaning in Javascript Reserved words are the ones that you use to provide the instructions on what the program is to do You cannot use these words as variable or function names. 15
16 Reserved words examples Other keywords 16
17 Variables Examples var x; var carname; var x=5; var carname="volvo"; the variables are empty (they have no values yet). can also assign values to the variables when you declare them: The word var is optional, but it s good style to use it these statements: x=5; carname="volvo"; have the same effect as: var x=5; var carname="volvo"; Variables If you redeclare a JavaScript variable, it will not lose its original value. var x=5; var x; it will not lose its original value. Variables are untyped (they can hold values of any type) 17
18 Example A variable's value can change during the execution of a script. You can refer to a variable by its name to display or change its value. Example <script type="text/javascript"> var firstname; firstname="hege"; document.write(firstname); document.write("<br />"); firstname="tove"; document.write(firstname); </script> <p> The script above declares a variable,assigns a value to it, displays the value, change the value,and displays the value again. </p> Example <html> <head> <title>javascript Variables</title> <script language="javascript"> var first_name="christian"; // first_name is assigned a value var last_name="dobbins"; // last_name is assigned a value var age = 8; var ssn; // Unassigned variable var job_title=null; </script> </head> Example <body bgcolor="lightblue"> <font="+1"> <script> document.write("<b>name:</b> " + first_name + " " + last_name + "<br>"); document.write("<b>age:</b> " + age + "<br>"); document.write("<b>ssn:</b> " + ssn + "<br>"); document.write("<b>job Title:</b> " + job_title + "<br>"); ssn="xxx-xx-xxxx"; document.write("<b>now Ssn is:</b> " + ssn, "<br>"); </script> <body><p><img src="christian.gif"></body> </html> 18
19 Passing variables by value (read-only) information can be read by the function, procedure, method, subroutine, etc. but not modified by reference passes a pointer to the variable, rather than the value, and ensures that the variable is read-write, when in scope global variables are in scope for the duration of the programs executionand are read-write for all statements that access them. Types Type system defines how a PL classifies values and expressions into types can manipulate those types and how they interact 19
20 Types Typed versus untyped languages A language is typed if the specification of every operation defines types of data to which the operation is applicable example, "this text between the quotes" is a string, dividing a number by a string has no meaning in most PL Languages usually allow the possibility to cast (convert) between compatible types Types Weak and strong typing Weak typing allows a value of one type to be treated as another, for example treating a string as a number. JavaScript permits a large number of implicit type conversions 2 * x implicitly converts x to a number, and this conversion succeeds even if x is null, undefined, or a string of letters Strong typing prevents the above perform an operation on the wrong type of value -> an error 20
21 Javascript Variable Types Primitive Types provided by the system Booleans, numbers and text treated as value types and when you pass them around they go as values some types, such as string, allow method calls User-defined types in addition to the primitive types, users may define their own classes -> objects thus, a complex type is an object, be it either standard or custom made. it goes everywhere by reference Javascript types Primitive Types provided by Javascript: booleans, numbers and text user-defined classes treated by Javascript as value types and when you pass them around they go as values some types, such as string, allow method calls 21
22 Primative Variable Types Boolean Type can only have 2 possible values, true or false var mayday = false;var birthday = true; 0, "0", empty strings, undefined, null, and NaN are false, other values are true NaN, which stands for Not a Number, is a value or symbol that is usually produced as the result of an operation on invalid input operands Primitive Type Examples Numeric Types both Integer and Float are a numeric significant digits base type exponent var sal = 20;var pal = 12.1; in ECMA Javascript your number literals can go from 0 to e+308. multiplied by ten to the power of = anything smaller than the smallest infinitesimal (5e-324) is rounded to 0. 22
23 Primitive Type Examples Numeric Type numbers are always stored as floating-point values Hexadecimal numbers begin with 0x Some platforms treat 0123 as octal, others treat it as decimal Since you can t be sure, avoid octal altogether Primative Variable Types String Types string and char types are all strings, so you can build any string literal that you want var myname = "Some Name";var mychar = 'f'; Strings may be enclosed in single quotes or double quotes Strings can contain \n (newline), \" (double quote), etc 23
24 JavaScript escape sequences JavaScript escape sequences <html> example <head> </head> <body> <pre> <font size="+2"> <script language="javascript"><!-- Hide script from old browsers. document.write( \t\thello\nworld!\n"); document.writeln( \"Nice day, Mate.\ \n"); document.writeln('smiley face:<font size="+3"> \u263a\n');//end hiding here. --> </script> </pre> </body> </html> 24
25 Complex Types standard or custom made Array Type untyped, so you can put everything you want in an Array possible to have thousands of items in an array Arrays are objects, they have methods and properties you can invoke at will e.g., the ".length" property indicates how many things are currently in the array var myarray = new Array(0, 2, 4);var myotherarray = new Array(); Complex Types Array Type can also be created with the array notation, which uses square brackets: var myarray = [0, 2, 4];var myotherarray = []; Arrays are accessed using the square brackets: myarray[2] = "Hello";var text = myarray[2]; 25
26 Complex Types Object Types An object within Javascript is created using the new operator: var myobject = new Object(); Objects can also be created with the object notation, which uses curly braces: var myobject = {}; JavaScript Objects can be built using inheritance and overriding, and you can use polymorphism. There are no scope modifiers, with all properties and methods having public access. Variable scope In computer programming, scope is an enclosing context where values and expressions are associated. Various programming languages have various types of scopes. The type of scope determines what kind of entities it can contain and how it affects them -- or semantics. 26
27 Variable scope local variables are those that are in scope within a specific part of the function, procedure, method, or subroutine, global variables are those that are in scope for the duration of program execution; can be accessed by any part of the program, and are read-write for all statements that access them Scope In Javascript Variables declared within a function are local to that function (accessible only within that function) if a variable is initialized inside a function without var, it will have a global scope. Variables declared outside a function are global (accessible from anywhere on the page) A local variable can have the same name as a global variable 27
28 Example declare a global variable a and assign it a value of 10 call a function in which we again initialize a variable named a var a = 10; disp_a( ); function disp_a( ) { var a = 20; alert("value of 'a' inside the function " + a); } alert("value of 'a' outside the function " + a); Example example var a = 10; disp_a( ); function disp_a( ) { var a = 20; alert("value of 'a' inside the function " + a); } alert("value of 'a' outside the function " + a); since we have used the var keyword inside the function, the variable a will have a local scope once we come out of the function, the local variable no longer exists and the global variable takes over. 28
29 Type conversion Example from W3C 29
3 The Building Blocks: Data Types, Literals, and Variables
chapter 3 The Building Blocks: Data Types, Literals, and Variables 3.1 Data Types A program can do many things, including calculations, sorting names, preparing phone lists, displaying images, validating
More informationCGS 3066: Spring 2015 JavaScript Reference
CGS 3066: Spring 2015 JavaScript Reference Can also be used as a study guide. Only covers topics discussed in class. 1 Introduction JavaScript is a scripting language produced by Netscape for use within
More informationJavaScript Introduction
JavaScript Introduction What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is usually embedded directly into HTML pages JavaScript is an interpreted language (means
More informationJavascript. UNIVERSITY OF MASSACHUSETTS AMHERST CMPSCI 120 Fall 2010
Lecture 15 Javascript Announcements Project #1 Graded VG, G= doing well, OK = did the minimum, OK - = some issues, do better on P#2 Homework #6 posted, due 11/5 Get JavaScript by Example Most examples
More informationPrincess Nourah bint Abdulrahman University. Computer Sciences Department
Princess Nourah bint Abdulrahman University 1 And use http://www.w3schools.com/ JavaScript Objectives Introduction to JavaScript Objects Data Variables Operators Types Functions Events 4 Why Study JavaScript?
More informationCSC Web Programming. Introduction to JavaScript
CSC 242 - Web Programming Introduction to JavaScript JavaScript JavaScript is a client-side scripting language the code is executed by the web browser JavaScript is an embedded language it relies on its
More informationWhat is Java Script? Writing to The HTML Document. What Can JavaScript do? CMPT 165: Java Script
What is Java Script? CMPT 165: Java Script Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University November 7, 2011 JavaScript was designed to add interactivity to HTML pages
More informationJavaScript: The Basics
JavaScript: The Basics CISC 282 October 4, 2017 JavaScript A programming language "Lightweight" and versatile Not universally respected Appreciated in the web domain Adds programmatic functionality to
More informationJAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)
Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 1 Professional Program: Data Administration and Management JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) WHO
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More informationJavaScript CS 4640 Programming Languages for Web Applications
JavaScript CS 4640 Programming Languages for Web Applications 1 How HTML, CSS, and JS Fit Together {css} javascript() Content layer The HTML gives the page structure and adds semantics Presentation
More informationPHP and MySQL for Dynamic Web Sites. Intro Ed Crowley
PHP and MySQL for Dynamic Web Sites Intro Ed Crowley Class Preparation If you haven t already, download the sample scripts from: http://www.larryullman.com/books/phpand-mysql-for-dynamic-web-sitesvisual-quickpro-guide-4thedition/#downloads
More informationClient-Side Web Technologies. JavaScript Part I
Client-Side Web Technologies JavaScript Part I JavaScript First appeared in 1996 in Netscape Navigator Main purpose was to handle input validation that was currently being done server-side Now a powerful
More informationCS112 Lecture: Primitive Types, Operators, Strings
CS112 Lecture: Primitive Types, Operators, Strings Last revised 1/24/06 Objectives: 1. To explain the fundamental distinction between primitive types and reference types, and to introduce the Java primitive
More informationJavaScript CS 4640 Programming Languages for Web Applications
JavaScript CS 4640 Programming Languages for Web Applications 1 How HTML, CSS, and JS Fit Together {css} javascript() Content layer The HTML gives the page structure and adds semantics Presentation
More informationDocuments and computation. Introduction to JavaScript. JavaScript vs. Java Applet. Myths. JavaScript. Standard
Introduction to Prof. Ing. Andrea Omicini II Facoltà di Ingegneria, Cesena Alma Mater Studiorum, Università di Bologna andrea.omicini@unibo.it Documents and computation HTML Language for the description
More informationStandard 11. Lesson 9. Introduction to C++( Up to Operators) 2. List any two benefits of learning C++?(Any two points)
Standard 11 Lesson 9 Introduction to C++( Up to Operators) 2MARKS 1. Why C++ is called hybrid language? C++ supports both procedural and Object Oriented Programming paradigms. Thus, C++ is called as a
More informationChapter 3 Data Types and Variables
Chapter 3 Data Types and Variables Adapted from JavaScript: The Complete Reference 2 nd Edition by Thomas Powell & Fritz Schneider 2004 Thomas Powell, Fritz Schneider, McGraw-Hill Jargon Review Variable
More informationA.A. 2008/09. Why introduce JavaScript. G. Cecchetti Internet Software Technologies
Internet t Software Technologies JavaScript part one IMCNE A.A. 2008/09 Gabriele Cecchetti Why introduce JavaScript To add dynamicity and interactivity to HTML pages 2 What s a script It s a little interpreted
More informationWhat is PHP? [1] Figure 1 [1]
PHP What is PHP? [1] PHP is an acronym for "PHP: Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed on the server PHP is free to download and use Figure
More informationWeiss Chapter 1 terminology (parenthesized numbers are page numbers)
Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement
More informationWorking with JavaScript
Working with JavaScript Creating a Programmable Web Page for North Pole Novelties 1 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page 2 Objectives
More informationChapter 2 Basic Elements of C++
C++ Programming: From Problem Analysis to Program Design, Fifth Edition 2-1 Chapter 2 Basic Elements of C++ At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion
More informationPHP by Pearson Education, Inc. All Rights Reserved.
PHP 1992-2012 by Pearson Education, Inc. All Client-side Languages User-agent (web browser) requests a web page JavaScript is executed on PC http request Can affect the Browser and the page itself http
More informationCOMS 469: Interactive Media II
COMS 469: Interactive Media II Agenda Review Data Types & Variables Decisions, Loops, and Functions Review gunkelweb.com/coms469 Review Basic Terminology Computer Languages Interpreted vs. Compiled Client
More informationCHAPTER 6 JAVASCRIPT PART 1
CHAPTER 6 JAVASCRIPT PART 1 1 OVERVIEW OF JAVASCRIPT JavaScript is an implementation of the ECMAScript language standard and is typically used to enable programmatic access to computational objects within
More informationLecture 05 I/O statements Printf, Scanf Simple statements, Compound statements
Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 05 I/O statements Printf, Scanf Simple
More informationSuch JavaScript Very Wow
Such JavaScript Very Wow Lecture 9 CGS 3066 Fall 2016 October 20, 2016 JavaScript Numbers JavaScript numbers can be written with, or without decimals. Extra large or extra small numbers can be written
More informationClient vs Server Scripting
Client vs Server Scripting PHP is a server side scripting method. Why might server side scripting not be a good idea? What is a solution? We could try having the user download scripts that run on their
More information<form>. input elements. </form>
CS 183 4/8/2010 A form is an area that can contain form elements. Form elements are elements that allow the user to enter information (like text fields, text area fields, drop-down menus, radio buttons,
More informationUNIT -II. Language-History and Versions Introduction JavaScript in Perspective-
UNIT -II Style Sheets: CSS-Introduction to Cascading Style Sheets-Features- Core Syntax-Style Sheets and HTML Style Rle Cascading and Inheritance-Text Properties-Box Model Normal Flow Box Layout- Beyond
More informationEntry Point of Execution: the main Method. Elementary Programming. Compile Time vs. Run Time. Learning Outcomes
Entry Point of Execution: the main Method Elementary Programming EECS2030: Advanced Object Oriented Programming Fall 2017 CHEN-WEI WANG For now, all your programming exercises will be defined within the
More informationC++ Programming: From Problem Analysis to Program Design, Third Edition
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine
More informationJavaScript: Introduction, Types
JavaScript: Introduction, Types Computer Science and Engineering College of Engineering The Ohio State University Lecture 19 History Developed by Netscape "LiveScript", then renamed "JavaScript" Nothing
More informationJavaScript Lecture 1
JavaScript Lecture 1 Waterford Institute of Technology May 17, 2016 John Fitzgerald Waterford Institute of Technology, JavaScriptLecture 1 1/31 Javascript Extent of this course A condensed basic JavaScript
More informationArrays Structured data Arrays What is an array?
The contents of this Supporting Material document have been prepared from the Eight units of study texts for the course M150: Date, Computing and Information, produced by The Open University, UK. Copyright
More informationThis course is designed for web developers that want to learn HTML5, CSS3, JavaScript and jquery.
HTML5/CSS3/JavaScript Programming Course Summary Description This class is designed for students that have experience with basic HTML concepts that wish to learn about HTML Version 5, Cascading Style Sheets
More informationC++ Basics. Lecture 2 COP 3014 Spring January 8, 2018
C++ Basics Lecture 2 COP 3014 Spring 2018 January 8, 2018 Structure of a C++ Program Sequence of statements, typically grouped into functions. function: a subprogram. a section of a program performing
More informationFeatures of C. Portable Procedural / Modular Structured Language Statically typed Middle level language
1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC
More informationJavaScript s role on the Web
Chris Panayiotou JavaScript s role on the Web JavaScript Programming Language Developed by Netscape for use in Navigator Web Browsers Purpose make web pages (documents) more dynamic and interactive Change
More informationCSCE 120: Learning To Code
CSCE 120: Learning To Code Manipulating Data I Introduction This module is designed to get you started working with data by understanding and using variables and data types in JavaScript. It will also
More informationSession 16. JavaScript Part 1. Reading
Session 16 JavaScript Part 1 1 Reading Reading Wikipedia en.wikipedia.org/wiki/javascript / p W3C www.w3.org/tr/rec-html40/interact/scripts.html Web Developers Notes www.webdevelopersnotes.com/tutorials/javascript/
More informationJME Language Reference Manual
JME Language Reference Manual 1 Introduction JME (pronounced jay+me) is a lightweight language that allows programmers to easily perform statistic computations on tabular data as part of data analysis.
More informationLecture 2 Tao Wang 1
Lecture 2 Tao Wang 1 Objectives In this chapter, you will learn about: Modular programs Programming style Data types Arithmetic operations Variables and declaration statements Common programming errors
More information2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program
Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Parts of a C++ Program Parts of a C++ Program // sample C++ program
More informationChapter 3 - Simple JavaScript - Programming Basics. Lesson 1 - JavaScript: What is it and what does it look like?
Chapter 3 - Simple JavaScript - Programming Basics Lesson 1 - JavaScript: What is it and what does it look like? PP presentation JavaScript.ppt. Lab 3.1. Lesson 2 - JavaScript Comments, document.write(),
More informationLECTURE 02 INTRODUCTION TO C++
PowerPoint Slides adapted from *Starting Out with C++: From Control Structures through Objects, 7/E* by *Tony Gaddis* Copyright 2012 Pearson Education Inc. COMPUTER PROGRAMMING LECTURE 02 INTRODUCTION
More informationIntroduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p.
Preface p. xiii Introduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p. 5 Client-Side JavaScript: Executable Content
More informationObjectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program
Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationChapter 2: Basic Elements of C++
Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationChapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction
Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers
More informationChapter 2 Working with Data Types and Operators
JavaScript, Fourth Edition 2-1 Chapter 2 Working with Data Types and Operators At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics
More information9/5/2018. Overview. The C Programming Language. Transitioning to C from Python. Why C? Hello, world! Programming in C
Overview The C Programming Language (with material from Dr. Bin Ren, William & Mary Computer Science) Motivation Hello, world! Basic Data Types Variables Arithmetic Operators Relational Operators Assignments
More informationBasics of Java Programming
Basics of Java Programming Lecture 2 COP 3252 Summer 2017 May 16, 2017 Components of a Java Program statements - A statement is some action or sequence of actions, given as a command in code. A statement
More informationThe C Programming Language. (with material from Dr. Bin Ren, William & Mary Computer Science)
The C Programming Language (with material from Dr. Bin Ren, William & Mary Computer Science) 1 Overview Motivation Hello, world! Basic Data Types Variables Arithmetic Operators Relational Operators Assignments
More informationCopyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 11 Introduction to PHP
Chapter 11 Introduction to PHP 11.1 Origin and Uses of PHP Developed by Rasmus Lerdorf in 1994 PHP is a server-side scripting language, embedded in XHTML pages PHP has good support for form processing
More informationUnit Notes. ICAWEB411A Produce basic client-side script for dynamic web pages Topic 1 Introduction to JavaScript
Unit Notes ICAWEB411A Produce basic client-side script for dynamic web pages Topic 1 Introduction to JavaScript Copyright, 2013 by TAFE NSW - North Coast Institute Date last saved: 18 September 2013 by
More informationThis tutorial will help you understand JSON and its use within various programming languages such as PHP, PERL, Python, Ruby, Java, etc.
About the Tutorial JSON or JavaScript Object Notation is a lightweight text-based open standard designed for human-readable data interchange. The JSON format was originally specified by Douglas Crockford,
More informationTester vs. Controller. Elementary Programming. Learning Outcomes. Compile Time vs. Run Time
Tester vs. Controller Elementary Programming EECS1022: Programming for Mobile Computing Winter 2018 CHEN-WEI WANG For effective illustrations, code examples will mostly be written in the form of a tester
More informationSEEM4570 System Design and Implementation Lecture 03 JavaScript
SEEM4570 System Design and Implementation Lecture 03 JavaScript JavaScript (JS)! Developed by Netscape! A cross platform script language! Mainly used in web environment! Run programs on browsers (HTML
More informationElementary Programming
Elementary Programming EECS1022: Programming for Mobile Computing Winter 2018 CHEN-WEI WANG Learning Outcomes Learn ingredients of elementary programming: data types [numbers, characters, strings] literal
More informationJavaScript: Introductionto Scripting
6 Comment is free, but facts are sacred. C. P. Scott The creditor hath a better memory than the debtor. James Howell When faced with a decision, I always ask, What would be the most fun? Peggy Walker Equality,
More informationProgram Fundamentals
Program Fundamentals /* HelloWorld.java * The classic Hello, world! program */ class HelloWorld { public static void main (String[ ] args) { System.out.println( Hello, world! ); } } /* HelloWorld.java
More informationEntry Point of Execution: the main Method. Elementary Programming. Learning Outcomes. Development Process
Entry Point of Execution: the main Method Elementary Programming EECS1021: Object Oriented Programming: from Sensors to Actuators Winter 2019 CHEN-WEI WANG For now, all your programming exercises will
More informationLexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2005 Handout 6 Decaf Language Wednesday, September 7 The project for the course is to write a
More informationObject oriented programming. Instructor: Masoud Asghari Web page: Ch: 3
Object oriented programming Instructor: Masoud Asghari Web page: http://www.masses.ir/lectures/oops2017sut Ch: 3 1 In this slide We follow: https://docs.oracle.com/javase/tutorial/index.html Trail: Learning
More informationLexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2010 Handout Decaf Language Tuesday, Feb 2 The project for the course is to write a compiler
More informationCERTIFICATE IN WEB PROGRAMMING
COURSE DURATION: 6 MONTHS CONTENTS : CERTIFICATE IN WEB PROGRAMMING 1. PROGRAMMING IN C and C++ Language 2. HTML/CSS and JavaScript 3. PHP and MySQL 4. Project on Development of Web Application 1. PROGRAMMING
More informationTutorial 10: Programming with JavaScript
Tutorial 10: Programming with JavaScript College of Computing & Information Technology King Abdulaziz University CPCS-665 Internet Technology Objectives Learn the history of JavaScript Create a script
More informationLanguage Fundamentals Summary
Language Fundamentals Summary Claudia Niederée, Joachim W. Schmidt, Michael Skusa Software Systems Institute Object-oriented Analysis and Design 1999/2000 c.niederee@tu-harburg.de http://www.sts.tu-harburg.de
More informationJava Language Basics: Introduction To Java, Basic Features, Java Virtual Machine Concepts, Primitive Data Type And Variables, Java Operators,
Java Language Basics: Introduction To Java, Basic Features, Java Virtual Machine Concepts, Primitive Data Type And Variables, Java Operators, Expressions, Statements and Arrays. Java technology is: A programming
More informationPART I. Part II Answer to all the questions 1. What is meant by a token? Name the token available in C++.
Unit - III CHAPTER - 9 INTRODUCTION TO C++ Choose the correct answer. PART I 1. Who developed C++? (a) Charles Babbage (b) Bjarne Stroustrup (c) Bill Gates (d) Sundar Pichai 2. What was the original name
More informationCITS1231 Web Technologies. JavaScript
CITS1231 Web Technologies JavaScript Contents Introduction to JavaScript Variables Operators Conditional Statements Program Loops Popup Boxes Functions 2 User Interaction User interaction requires web
More informationObjectives. In this chapter, you will:
Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates arithmetic expressions Learn about
More informationSession 6. JavaScript Part 1. Reading
Session 6 JavaScript Part 1 Reading Reading Wikipedia en.wikipedia.org/wiki/javascript Web Developers Notes www.webdevelopersnotes.com/tutorials/javascript/ JavaScript Debugging www.w3schools.com/js/js_debugging.asp
More informationCSC Web Technologies, Spring Web Data Exchange Formats
CSC 342 - Web Technologies, Spring 2017 Web Data Exchange Formats Web Data Exchange Data exchange is the process of transforming structured data from one format to another to facilitate data sharing between
More informationFundamental of Programming (C)
Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 3 Constants, Variables, Data Types, And Operations Department of Computer Engineering
More informationHTML5 and CSS3 More JavaScript Page 1
HTML5 and CSS3 More JavaScript Page 1 1 HTML5 and CSS3 MORE JAVASCRIPT 3 4 6 7 9 The Math Object The Math object lets the programmer perform built-in mathematical tasks Includes several mathematical methods
More informationAjax Ajax Ajax = Asynchronous JavaScript and XML Using a set of methods built in to JavaScript to transfer data between the browser and a server in the background Reduces the amount of data that must be
More informationChapter 17. Fundamental Concepts Expressed in JavaScript
Chapter 17 Fundamental Concepts Expressed in JavaScript Learning Objectives Tell the difference between name, value, and variable List three basic data types and the rules for specifying them in a program
More informationLOON. Language Reference Manual THE LANGUAGE OF OBJECT NOTATION. Kyle Hughes, Jack Ricci, Chelci Houston-Borroughs, Niles Christensen, Habin Lee
LOON THE LANGUAGE OF OBJECT NOTATION Language Reference Manual Kyle Hughes, Jack Ricci, Chelci Houston-Borroughs, Niles Christensen, Habin Lee October 2017 1 Contents 1 Introduction 3 2 Types 4 2.1 JSON............................................
More informationManju Muralidharan Priya. CS4PM Web Aesthetics and Development WEEK 11
CS4PM Web Aesthetics and Development WEEK 11 Objective: Understand basics of JScript Outline: a. Basics of JScript Reading: Refer to w3schools websites and use the TRY IT YOURSELF editor and play with
More informationContents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual
Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Contents 1 Introduction...2 2 Lexical Conventions...2 3 Types...3 4 Syntax...3 5 Expressions...4 6 Declarations...8 7 Statements...9
More informationCSc Introduction to Computing
CSc 10200 Introduction to Computing Lecture 2 Edgardo Molina Fall 2011 - City College of New York Thursday, September 1, 2011 Introduction to C++ Modular program: A program consisting of interrelated segments
More informationWeb Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel
Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Introduction: PHP (Hypertext Preprocessor) was invented by Rasmus Lerdorf in 1994. First it was known as Personal Home Page. Later
More informationJavaScript: Control Statements I Pearson Education, Inc. All rights reserved.
1 7 JavaScript: Control Statements I 2 Let s all move one place on. Lewis Carroll The wheel is come full circle. William Shakespeare How many apples fell on Newton s head before he took the hint! Robert
More informationJavaScript. What s wrong with JavaScript?
JavaScript 1 What s wrong with JavaScript? A very powerful language, yet Often hated Browser inconsistencies Misunderstood Developers find it painful Lagging tool support Bad name for a language! Java
More informationJavaScript. History. Adding JavaScript to a page. CS144: Web Applications
JavaScript Started as a simple script in a Web page that is interpreted and run by the browser Supported by most modern browsers Allows dynamic update of a web page More generally, allows running an arbitrary
More informationVisual C# Instructor s Manual Table of Contents
Visual C# 2005 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion Topics Additional Projects Additional Resources Key Terms
More informationPHP 5 Introduction. What You Should Already Know. What is PHP? What is a PHP File? What Can PHP Do? Why PHP?
PHP 5 Introduction What You Should Already Know you should have a basic understanding of the following: HTML CSS What is PHP? PHP is an acronym for "PHP: Hypertext Preprocessor" PHP is a widely-used, open
More information\n is used in a string to indicate the newline character. An expression produces data. The simplest expression
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More informationJavaScript. History. Adding JavaScript to a page. CS144: Web Applications
JavaScript Started as a simple script in a Web page that is interpreted and run by the browser Supported by most modern browsers Allows dynamic update of a web page More generally, allows running an arbitrary
More informationCOMP284 Scripting Languages Lecture 14: JavaScript (Part 1) Handouts
COMP284 Scripting Languages Lecture 14: JavaScript (Part 1) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool
More informationBEFORE CLASS. If you haven t already installed the Firebug extension for Firefox, download it now from
BEFORE CLASS If you haven t already installed the Firebug extension for Firefox, download it now from http://getfirebug.com. If you don t already have the Firebug extension for Firefox, Safari, or Google
More information7/8/10 KEY CONCEPTS. Problem COMP 10 EXPLORING COMPUTER SCIENCE. Algorithm. Lecture 2 Variables, Types, and Programs. Program PROBLEM SOLVING
KEY CONCEPTS COMP 10 EXPLORING COMPUTER SCIENCE Lecture 2 Variables, Types, and Programs Problem Definition of task to be performed (by a computer) Algorithm A particular sequence of steps that will solve
More informationWeb Scripting using PHP
Web Scripting using PHP Server side scripting So what is a Server Side Scripting Language? Programming language code embedded into a web page PERL PHP PYTHON ASP Different ways of scripting the Web Programming
More informationBinghamton University. CS-211 Fall Syntax. What the Compiler needs to understand your program
Syntax What the Compiler needs to understand your program 1 Pre-Processing Any line that starts with # is a pre-processor directive Pre-processor consumes that entire line Possibly replacing it with other
More information1 Lexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Decaf Language Thursday, Feb 7 The project for the course is to write a compiler
More informationIntro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Why Learn to Program?
Intro to Programming & C++ Unit 1 Sections 1.1-4 and 2.1-10, 2.12-13, 2.15-17 CS 1428 Spring 2019 Jill Seaman 1.1 Why Program? Computer programmable machine designed to follow instructions Program a set
More informationWeb Programming Pre-01A Web Programming Technologies. Aryo Pinandito, ST, M.MT
Web Programming Pre-01A Web Programming Technologies Aryo Pinandito, ST, M.MT Document Formats: The evolution of HTML HTML HyperText Markup Language Primary document type for the web Transmitted using
More information