Client-Side Web Technologies. JavaScript Part I
|
|
- Archibald Stephens
- 6 years ago
- Views:
Transcription
1 Client-Side Web Technologies JavaScript Part I
2 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 programming language that has many uses for creating responsive and dynamic web applications Consists of: ECMAScript (ECMA-262) not tied to web browsers The Document Object Model (DOM) The Browser Object Model (BOM)
3 The script element Categories: Metadata content Flow content Phrasing content Content model: If no src attribute, then script content; otherwise empty Some additional attributes: src indicates the path to the external script file async indicates that an external script can begin downloading immediately (and executing immediately) type the content type; usually text/javascript See ScriptInsertion examples
4 Syntax is very C-like Case-sensitive language General Syntax Identifiers (variables, functions, etc.) must: Start with a letter, underscore ( _ ), or dollar sign ( $ ) Contain only letters, underscores, dollar signs, or numbers Statements are terminated by a semicolon ( ; ) Code blocks begin with a left curly brace ( { ) and end with a right curly brace ( } ) Like other programming languages, there are reserved words that cannot be used as identifiers: Comments: Single line: start with two forward slashes ( // ) Block comments begin with /* and end with */
5 Operators Operator Name Description + Unary Plus No effect on numeric values; will cause implicit conversion on non-numeric values - Unary Minus Negates a numeric value; will cause implicit conversion and then negation on non-numeric values ++ Increment Increments a numeric value by 1; can be prefix or postfix -- Decrement Decrements a numeric value by 1; can be prefix or postfix + Add When used on two number operands it performs addition on them; if one operands is a string then a new string is created by concatenating the two operands (implicitly converting the other operand to a string if necessary) - Subtract Performs subtraction using two number operands * Multiply Performs multiplication using two number operands / Divide Performs division using two number operands % Modulus Performs division using two number operands; the result is the remainder
6 Operators (continued) Operator Name Description! Logical NOT Negates a Boolean value; will cause implicit conversion and then negation on non-boolean values && Logical AND Returns true if and only if both Boolean operands evlauate to true, false otherwise; short-circuited; behavior differs for operands of non-boolean types Logical OR Returns false if and only if both Boolean operands evlauate to false, true otherwise; short-circuited; behavior differs for operands of non-boolean types == Equal Returns true if the two operands are equal; equality rules differ amongst data types; performs implicit type conversion when needed!= Not Equal Returns true if the two operands are not equal; equality rules differ amongst data types; performs implicit type conversion when needed === Strict Equal Same as Equal but does not do type conversion!== Strict Not Equal Same as Not Equal but does not do type conversion
7 Operators (continued) Operator Name Description < Less Than Returns true if the left operand is less than the right operand; the nature of the comparison differes amongst data types <= Less Than Or Equal Returns true if the left operand is less than or equal to the right operand; the nature of the comparison differes amongst data types > Greater Than Returns true if the left operand is greater than the right operand; the nature of the comparison differes amongst data types >= Greater Than Or Equal Returns true if the left operand is greater than or equal to the right operand; the nature of the comparison differes amongst data types = Assignment Assigns the value on the right side of the operator to the variable on the left side; compound assignments are allowed for many operators (E.g. +=, *=, etc.)
8 Operators (continued) Operator Name Description ~ Bitwise NOT Performs a bitwise NOT & Bitiwise AND Performs a bitwise AND Bitwise OR Performs a bitwise OR ^ Bitwise XOR Performs a bitwise XOR << Left Shift Shifts all bits to the left by the given number of positions (bits filled with 0's) >> Right Shift Shifts all bits to the right by the given number of positions (bits filled with 0's and maintains sign) >>> Unsigned Right Shift Shifts all bits to the right by the given number of positions (bits filled with 0's)
9 Flow Control Statements The if statement The while statement The do while statement The for statement The for-in statement The switch statement
10 The if Statement if ( condition ) { //some code } else if ( condition2 ) { //some code } else { //some code }
11 The while Statement while ( condition ) { } //some code
12 The do while Statement do { //some code } while ( condition );
13 The for Statement for ( initialization; condition; post loop expression ) { } //some code The for in Statement for ( property in expression ) { } //some code
14 The switch Statement switch ( expression ) { case value: statement break; case value: statement break; default: statement }
15 Data Types There are 7 fundamental data types: 6 primitive types Undefined Null Boolean Number String Symbol* 1 reference type Object * New in ECMAScript 6 (ECMAScript 2015)
16 Variables Variables are loosely typed Use the var operator to define variables var name; Variables can also be initialized when defined var name = Jeff ; Since variables are loosely typed we can do this (but don t!) var name = Jeff ; name = 23;
17 Variables Ways to declare variables var hoisted to top of function let block scope New in ECMAScript 6 (2015); good support across latest browsers const block scope and cannot be changed New in ECMAScript 6 (2015); good support across latest browsers When possible, use const Otherwise use let. Avoid var if possible.
18 typeof Operator To determine the data type of a given variable we can use the typeof operator var age = 35; console.log(typeof age); console.log(typeof(age)); // number // number Returns: undefined if the value is undefined (uninitialized or undeclared variable) boolean if the value is a boolean string if the value is a string number if the value is a number symbol if the value is a symbol object if the value is an object (other than a function) or null null is an empty object reference which is why typeof would return object function if the value is a function
19 The Undefined Type Has only one value, the special value undefined A declared variable that has not been initialized will be undefined var name; console.log(name === undefined) //true
20 The Null Type Has only one value, the special value null If you define a variable that you intend to later hold an object you should initialize the variable to null to allow null checking var myobject = null; if ( myobject!== null ) { } //do something
21 The Boolean Type Has two values, true and false All types have Boolean equivalents: Undefined: false Null: false Number: if the number is 0 or NaN, then false; true otherwise String: if an empty string then false; true otherwise Object: true Types are automatically converted as needed but you can explicitly convert to a Boolean type with the Boolean() function var mybool = Boolean( hello ); console.log(mybool); //true
22 The Number Type Supports integers and floating point numbers Number literal formats: Integers Decimal (base 10): 29 Hexadecimal(base 16): 0x1d Floating-point values Decimal point and at least one number after it: 3.14 E-notation: 1.785e2 or 3.8e-4 Like other languages, floating-point arithmetic can cause rounding errors (Google floating-point arithmetic ) = ???
23 The Number Type (continued) Number.MIN_VALUE = 5e-324 (most browsers) Number.MAX_VALUE = e+308 If the result of a calculation is out of range then the result is the special value Infinity (or -Infinity) The isfinite() function can be used to determine if a result is finite NaN (Not a Number) is a special numeric value used to indicate than operation that was intended to return a number has failed Any operation involving NaN returns NaN so you cannot use it in an equality check The isnan() function is for this purpose
24 The Number Type (continued) Number conversion functions Number() Converts to a number using a large number of rules var num = Number(false); //0 var num2 = Number( 34 ); //34 var num3 = Number( ); //0 parseint() Converts a string to an integer var num = parseint( ); //NaN var num2 = parseint( 22.5 ); //22 parsefloat() Converts a string to a number var num = parsefloat( 22.5 ); //22.5
25 The String Type Represents a sequence of zero or more 16-bit Unicode characters You can use single or double quotes to delineate strings var name = Jeff ; var name = Jeff ; Strings are immutable To convert a value of another type into a string: tostring() method Results vary from type to type and amongst different kinds of objects String() function
26 The Object Type Objects are a collection of properties and methods Objects are instances of reference types There are no classes in ECMAScript * Created using the new operator followed by the name of the reference type (constructor function) var myobject = new Object(); We can test if a variable is an instance of a given reference type using the instanceof operator if ( myobject instanceof MyRefType ) { } //Do stuff... We will discuss objects in depth later See TypesAndOperators example *ECMAScript 6 (ECMAScript 2015) introduces classes but are essentially syntactic sugar
27 Functions Declared with function keyword Functions do not care about the number or type of arguments Functions do not specify whether a value must be returned on not Functions cannot be overloaded If two functions share the same name then the most recently declared function will own that name All arguments are passed by VALUE See Functions\Functions example
28 Execution Context For variables and functions it defines what data is accessible and how it should behave The global execution context is the outermost context This is the window object All global variables and functions are properties and methods on the window object Each function call gets its own execution context When code execution flows into a function its context is pushed onto a context stack
29 Scope Chain Used in identifier resolution Provides ordered access to all variables and functions an execution context has access to The beginning of the chain is the context of the currently executing code The end of the chain is the global execution context Identifiers are resolved by navigating the chain beginning to end Declaring a variable with var adds the variable to the most immediate context available
30 Closures Functions that have access to variables from another function s scope are called closures Inner functions still have access to outer function variables even if the outer function finishes executing See the ScopeAndClosures.html example
31 Memory Management JavaScript manages memory for you via garbage collection It automatically allocates and reclaims memory The garbage collector runs automatically Some browsers allow you to explicitly initiate collection but this is generally not recommended It is good practice to set global values to null (dereferencing) when no longer needed so their memory can be reclaimed (avoid globals though) Local variables are automatically dereferenced when they go out of context
32 Native Reference Types Object Function Array Date RegExp Primitive Wrappers Boolean Number String Math Global*
33 The Object Type Ways to create an instance of Object Use the new operator followed by the Object() constructor Object literal notation: Constructor function is not called Preferred way to pass large number of optional parameters to a function var myobject = { age: 18 };
34 The Object Type (continued) Each instance of an Object has the following properties and methods: constructor function used to create the instance hasownproperty(propertyname) indicates if a given property exists on the object instance (not on prototype) isprototypeof(object) determines if an object is a prototype of another propertyisenumerable(propertyname) can enumerate the property using the for-in loop tostring() returns a string representation of the object tolocalstring() returns a string representation of the object appropriate for locale of execution environment valueof() returns a string, number, or Boolean equivalent of the object See the ObjectType example
35 The Function Type All functions are instances of the Function reference type Therefore, all functions are objects Function names are really just variables that point to objects of the Function type Ways to create a function Function declarations (what we have seen thus far) Function expressions Use the new operator followed by the Function() constructor
36 The Function Type (continued) Inside function body there is a special object called this It points to the context object that the function is operating on Functions also have a length property that reflects the number of named parameters
37 The Function Type (continued) The apply() and call() methods on the Function type allow us to call functions supplying a specific object for the function to use as its this value apply() takes two arguments the object to use as the this pointer and an array or arguments to pass the function (can be the special arguments object as well) call() takes multiple arguments the first is the object to use as the this pointer and subsequent arguments are passed directly to the function The bind() function (new in ECMAScript 5) creates a new instance of the Function type whose this pointer will refer to the object passed in as a parameter to bind() See the Functions\Functions2 example
38 Ordered list of data The Array Type Can contain a mix of different types Dynamically sized as needed Get/set contents using square brackets ([]) myarray[2] = hello ; Indexes are zero-based numbers If setting an item with index past the end, the array length is automatically increased to index + 1 Arrays have a length property that can be read from and written to Can use Array.isArray() instead of instanceof Array
39 The Array Type (continued) Ways to create an Array instance: Use the new operator followed by the Array() constructor Array literal notation Constructor function is not called var myarray = [ hello, bye ];
40 Array Methods Method join() concat() slice() splice() push() pop() unshift() shift() Description Joins all items into a string, delimited by the separator, and returns the string Joins two or more arrays and returns the new array Returns a new array with the items in the supplied range Adds/removes items to/from an array and returns the removed items Adds new items to the end of the array and returns the new length Removes the last item in the array and returns that item Adds new items to the beginning of the array and returns the new length Removes the first item in the array and returns that item
41 Array Methods (continued) Method sort() reverse() indexof() lastindexof() every() some() foreach() Description Sorts the original array Reverses the order of items in the original array Searches the array (forward) for a specified item and returns its position Searches the array (backward) for a specified item and returns its position Runs the given function on every item in the array and returns true if the function returns true for every item Runs the given function on every item in the array and returns true if the function returns true for any one item Runs the given function on every item in the array
42 Array Methods (continued) Method filter() map() Description Runs the given function on every item in the array and returns an array of all items for which the function returns true Runs the given function on every item in the array and returns the result of each function call in an array See the ArrayType example
43 The Date Type Stores date and time as the number of milliseconds elapsed since midnight on January 1 st, 1970 Created using the new operator and the Date() constructor If no arguments, the new object represents the current date/time Can supply arguments to create an object for a given date/time Lots of methods See the DateType example
44 The RegExp Type Allows for matching patterns in text using regular expressions More info on regular expressions: Ways to create a RegExp instance: The new operator followed by the RexExp() constructor Literal form See the RegExp example
45 The Boolean Type When a Boolean primitive type variable is read for property/method access, an object of the Boolean reference type is created to wrap the primitive value for the read operation The object is immediately destroyed afterwards You can explicitly create an instance using the new operator and the Boolean() constructor
46 The Number Type When a Number primitive type variable is read for property/method access, an object of the Number reference type is created to wrap the primitive value for the read operation The object is immediately destroyed afterwards You can explicitly create an instance using the new operator and the Number() constructor Defines some useful methods:
47 The String Type When a String primitive type variable is read for property/method access, an object of the String reference type is created to wrap the primitive value for the read operation The object is immediately destroyed afterwards You can explicitly create an instance using the new operator and the String() constructor Defines many useful methods: Defines a length property See the PrimitiveWrapperTypes example
48 The Math Object Provides methods and properties useful in mathematical computations Is a singleton Cannot create your own instance Instead do this: Math.sqrt(4) Math.pow(2, 8) Math.PI Math.random()
49 The Global Object Is a singleton All global variables and functions are actually properties and methods on the global object Web browsers implement the Global Object via the window object Defines a number of properties and methods We have already looked at many of them isfinite() isnan() parseint() Etc...
50 The Global Object (continued) The eval() method Extremely powerful Executes the string argument as a script Code executed by eval() is part of the same execution context as that from which the call to eval() was made There are performance and security concerns with eval()
51 Strict Mode New in ECMAScript 5 Can apply to entire scripts or functions Put the following before any code in the script or function use strict Backwards compatible Prevents certain actions from being taken Cannot assign variables that have not been defined (nonstrict puts these on the global object) Cannot use eval to introduce new variables into containing scope arguments.callee not supported Other things...
52 Exception Handling ECMAScript supports try-catch-finally statements Can also throw exceptions See Exceptions example
JavaScript 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 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 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 informationJAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)
Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 2 Professional Program: Data Administration and Management JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) AGENDA
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. 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 informationCOMP519 Web Programming Lecture 12: JavaScript (Part 3) Handouts
COMP519 Web Programming Lecture 12: JavaScript (Part 3) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool
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 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 informationIndex COPYRIGHTED MATERIAL
Index COPYRIGHTED MATERIAL Note to the Reader: Throughout this index boldfaced page numbers indicate primary discussions of a topic. Italicized page numbers indicate illustrations. A abstract classes
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 informationOperators. Java operators are classified into three categories:
Operators Operators are symbols that perform arithmetic and logical operations on operands and provide a meaningful result. Operands are data values (variables or constants) which are involved in operations.
More informationMatchaScript: Language Reference Manual Programming Languages & Translators Spring 2017
MatchaScript: Language Reference Manual Programming Languages & Translators Spring 2017 Language Guru: Kimberly Hou - kjh2146 Systems Architect: Rebecca Mahany - rlm2175 Manager: Jordi Orbay - jao2154
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 informationSir Muhammad Naveed. Arslan Ahmed Shaad ( ) Muhammad Bilal ( )
Sir Muhammad Naveed Arslan Ahmed Shaad (1163135 ) Muhammad Bilal ( 1163122 ) www.techo786.wordpress.com CHAPTER: 2 NOTES:- VARIABLES AND OPERATORS The given Questions can also be attempted as Long Questions.
More informationJAVASCRIPT. sarojpandey.com.np/iroz. JavaScript
JAVASCRIPT 1 Introduction JAVASCRIPT is a compact, object-based scripting language for developing client Internet applications. was designed to add interactivity to HTML pages. is a scripting language
More informationCITS1231 Web Technologies. JavaScript Math, String, Array, Number, Debugging
CITS1231 Web Technologies JavaScript Math, String, Array, Number, Debugging Last Lecture Introduction to JavaScript Variables Operators Conditional Statements Program Loops Popup Boxes Functions 3 This
More informationExpressions and Data Types CSC 121 Spring 2015 Howard Rosenthal
Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types
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 informationCOMP284 Scripting Languages Lecture 15: JavaScript (Part 2) Handouts
COMP284 Scripting Languages Lecture 15: JavaScript (Part 2) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool
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 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 informationUNIT- 3 Introduction to C++
UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage
More informationSECTION II: LANGUAGE BASICS
Chapter 5 SECTION II: LANGUAGE BASICS Operators Chapter 04: Basic Fundamentals demonstrated declaring and initializing variables. This chapter depicts how to do something with them, using operators. Operators
More informationThe Arithmetic Operators. Unary Operators. Relational Operators. Examples of use of ++ and
The Arithmetic Operators The arithmetic operators refer to the standard mathematical operators: addition, subtraction, multiplication, division and modulus. Op. Use Description + x + y adds x and y x y
More informationThe Arithmetic Operators
The Arithmetic Operators The arithmetic operators refer to the standard mathematical operators: addition, subtraction, multiplication, division and modulus. Examples: Op. Use Description + x + y adds x
More informationJavaScript Basics. The Big Picture
JavaScript Basics At this point, you should have reached a certain comfort level with typing and running JavaScript code assuming, of course, that someone has already written it for you This handout aims
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 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++ 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 5: JavaScript Basics 99
CHAPTER 5: JavaScript Basics 99 5.2 JavaScript Keywords, Variables, and Operators 5.2.1 JavaScript Keywords break case continue default delete do else export false for function if import in new null return
More informationOverview: Programming Concepts. Programming Concepts. Names, Values, And Variables
Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Fluency with Information Technology Third Edition by Lawrence Snyder Overview: Programming Concepts Programming: Act of formulating
More informationOverview: Programming Concepts. Programming Concepts. Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript
Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Fluency with Information Technology Third Edition by Lawrence Snyder Overview: Programming Concepts Programming: Act of formulating
More informationSymbols. accessor properties, attributes, creating, adding properties, 8 anonymous functions, 20, 80
Index Symbols { } (braces) for function contents, 18 and object properties, 9 == (double equals operator), 5 === (triple equals operator), 5 [ ] (square brackets) for array literals, 10 for property access,
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 informationJavaScript I Language Basics
JavaScript I Language Basics Chesapeake Node.js User Group (CNUG) https://www.meetup.com/chesapeake-region-nodejs-developers-group START BUILDING: CALLFORCODE.ORG Agenda Introduction to JavaScript Language
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 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 informationJavaScript: Sort of a Big Deal,
: Sort of a Big Deal, But Sort of Quirky... March 20, 2017 Lisp in C s Clothing (Crockford, 2001) Dynamically Typed: no static type annotations or type checks. C-Like Syntax: curly-braces, for, semicolons,
More informationCOMP519 Web Programming Lecture 11: JavaScript (Part 2) Handouts
COMP519 Web Programming Lecture 11: JavaScript (Part 2) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool
More informationExpressions and Data Types CSC 121 Fall 2015 Howard Rosenthal
Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types and
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 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 informationOperators and Expressions
Operators and Expressions Conversions. Widening and Narrowing Primitive Conversions Widening and Narrowing Reference Conversions Conversions up the type hierarchy are called widening reference conversions
More information3. Java - Language Constructs I
Educational Objectives 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations, Evaluation of Expressions, Type Conversions You know the basic blocks
More informationC Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee
C Language Part 1 (Minor modifications by the instructor) References C for Python Programmers, by Carl Burch, 2011. http://www.toves.org/books/cpy/ The C Programming Language. 2nd ed., Kernighan, Brian,
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 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 informationCSC 1214: Object-Oriented Programming
CSC 1214: Object-Oriented Programming J. Kizito Makerere University e-mail: jkizito@cis.mak.ac.ug www: http://serval.ug/~jona materials: http://serval.ug/~jona/materials/csc1214 e-learning environment:
More informationCS201 Some Important Definitions
CS201 Some Important Definitions For Viva Preparation 1. What is a program? A program is a precise sequence of steps to solve a particular problem. 2. What is a class? We write a C++ program using data
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationLecture 3: The Basics of JavaScript. Background. Needs for Programming Capability. Origin of JavaScript. Using Client-side JavaScript
Lecture 3: The Basics of JavaScript Wendy Liu CSC309F Fall 2007 Background Origin and facts 1 2 Needs for Programming Capability XHTML and CSS allows the browser to passively display static content How
More informationLanguage Reference Manual simplicity
Language Reference Manual simplicity Course: COMS S4115 Professor: Dr. Stephen Edwards TA: Graham Gobieski Date: July 20, 2016 Group members Rui Gu rg2970 Adam Hadar anh2130 Zachary Moffitt znm2104 Suzanna
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 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 informationSprite an animation manipulation language Language Reference Manual
Sprite an animation manipulation language Language Reference Manual Team Leader Dave Smith Team Members Dan Benamy John Morales Monica Ranadive Table of Contents A. Introduction...3 B. Lexical Conventions...3
More informationJavaScript Basics. Mendel Rosenblum. CS142 Lecture Notes - JavaScript Basics
JavaScript Basics Mendel Rosenblum 1 What is JavaScript? From Wikipedia:... high-level, dynamic, untyped, and interpreted programming language... is prototype-based with first-class functions,... supporting
More informationChapter 3: Operators, Expressions and Type Conversion
101 Chapter 3 Operators, Expressions and Type Conversion Chapter 3: Operators, Expressions and Type Conversion Objectives To use basic arithmetic operators. To use increment and decrement operators. To
More informationIntroduction to Web Tech and Programming
Introduction to Web Tech and Programming Objects Objects Arrays JavaScript Objects Objects are an unordered collection of properties. Basically variables holding variables. Have the form name : value name
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 informationJAVA Programming Fundamentals
Chapter 4 JAVA Programming Fundamentals By: Deepak Bhinde PGT Comp.Sc. JAVA character set Character set is a set of valid characters that a language can recognize. It may be any letter, digit or any symbol
More informationA flow chart is a graphical or symbolic representation of a process.
Q1. Define Algorithm with example? Answer:- A sequential solution of any program that written in human language, called algorithm. Algorithm is first step of the solution process, after the analysis of
More informationTypescript on LLVM Language Reference Manual
Typescript on LLVM Language Reference Manual Ratheet Pandya UNI: rp2707 COMS 4115 H01 (CVN) 1. Introduction 2. Lexical Conventions 2.1 Tokens 2.2 Comments 2.3 Identifiers 2.4 Reserved Keywords 2.5 String
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 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 informationTypes and Expressions. Chapter 3
Types and Expressions Chapter 3 Chapter Contents 3.1 Introductory Example: Einstein's Equation 3.2 Primitive Types and Reference Types 3.3 Numeric Types and Expressions 3.4 Assignment Expressions 3.5 Java's
More informationChapter 4 Basics of JavaScript
Chapter 4 Basics of JavaScript JavaScript/EcmaScript References The official EcmaScript, third edition, specification http://www.ecma-international.org/publications/files/ecma-st/ecma-262.pdf A working
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 informationJavaScript. Training Offer for JavaScript Introduction JavaScript. JavaScript Objects
JavaScript CAC Noida is an ISO 9001:2015 certified training center with professional experience that dates back to 2005. The vision is to provide professional education merging corporate culture globally
More informationObjects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003
Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 Java Programs A Java program contains at least one class definition. public class Hello { public static void
More informationA Java program contains at least one class definition.
Java Programs Identifiers Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 A Java program contains at least one class definition. public class Hello { public
More informationContents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix
PGJC4_JSE8_OCA.book Page ix Monday, June 20, 2016 2:31 PM Contents Figures Tables Examples Foreword Preface xix xxi xxiii xxvii xxix 1 Basics of Java Programming 1 1.1 Introduction 2 1.2 Classes 2 Declaring
More informationBackground. Javascript is not related to Java in anyway other than trying to get some free publicity
JavaScript I Introduction JavaScript traditionally runs in an interpreter that is part of a browsers Often called a JavaScript engine Was originally designed to add interactive elements to HTML pages First
More informationDeclaration and Memory
Declaration and Memory With the declaration int width; the compiler will set aside a 4-byte (32-bit) block of memory (see right) The compiler has a symbol table, which will have an entry such as Identifier
More informationJScript Reference. Contents
JScript Reference Contents Exploring the JScript Language JScript Example Altium Designer and Borland Delphi Run Time Libraries Server Processes JScript Source Files PRJSCR, JS and DFM files About JScript
More informationGO - OPERATORS. This tutorial will explain the arithmetic, relational, logical, bitwise, assignment and other operators one by one.
http://www.tutorialspoint.com/go/go_operators.htm GO - OPERATORS Copyright tutorialspoint.com An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.
More informationThe JavaScript Language
The JavaScript Language INTRODUCTION, CORE JAVASCRIPT Laura Farinetti - DAUIN What and why JavaScript? JavaScript is a lightweight, interpreted programming language with object-oriented capabilities primarily
More informationLe L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators
Course Name: Advanced Java Lecture 2 Topics to be covered Variables Operators Variables -Introduction A variables can be considered as a name given to the location in memory where values are stored. One
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 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 informationPrinceton University COS 333: Advanced Programming Techniques A Subset of JavaScript
Princeton University COS 333: Advanced Programming Techniques A Subset of JavaScript Program Structure function sqr(i) var result; // Otherwise result would be global. result = i * i; //
More informationJava Overview An introduction to the Java Programming Language
Java Overview An introduction to the Java Programming Language Produced by: Eamonn de Leastar (edeleastar@wit.ie) Dr. Siobhan Drohan (sdrohan@wit.ie) Department of Computing and Mathematics http://www.wit.ie/
More informationCS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University
CS5000: Foundations of Programming Mingon Kang, PhD Computer Science, Kennesaw State University Overview of Source Code Components Comments Library declaration Classes Functions Variables Comments Can
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 2 : C# Language Basics Lecture Contents 2 The C# language First program Variables and constants Input/output Expressions and casting
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 informationOutline. Data and Operations. Data Types. Integral Types
Outline Data and Operations Data Types Arithmetic Operations Strings Variables Declaration Statements Named Constant Assignment Statements Intrinsic (Built-in) Functions Data and Operations Data and Operations
More informationPoints To Remember for SCJP
Points To Remember for SCJP www.techfaq360.com The datatype in a switch statement must be convertible to int, i.e., only byte, short, char and int can be used in a switch statement, and the range of the
More informationCharacter Set. The character set of C represents alphabet, digit or any symbol used to represent information. Digits 0, 1, 2, 3, 9
Character Set The character set of C represents alphabet, digit or any symbol used to represent information. Types Uppercase Alphabets Lowercase Alphabets Character Set A, B, C, Y, Z a, b, c, y, z Digits
More informationChapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.
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 informationJewelScript Reference Manual
JewelScript Reference Manual Version 1.2, June 2014 www.jewe.org JewelScript Reference Manual 1 TOC Table of Contents TOC Language Documentation...5 Lexical structure...6 Identifiers...6 Keywords...6 Operators...6
More informationGeneral Syntax. Operators. Variables. Arithmetic. Comparison. Assignment. Boolean. Types. Syntax int i; float j = 1.35; int k = (int) j;
General Syntax Statements are the basic building block of any C program. They can assign a value to a variable, or make a comparison, or make a function call. They must be terminated by a semicolon. Every
More informationBASIC ELEMENTS OF A COMPUTER PROGRAM
BASIC ELEMENTS OF A COMPUTER PROGRAM CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING LOGO Contents 1 Identifier 2 3 Rules for naming and declaring data variables Basic data types 4 Arithmetic operators
More informationChapter 2: Using Data
Chapter 2: Using Data TRUE/FALSE 1. A variable can hold more than one value at a time. F PTS: 1 REF: 52 2. The legal integer values are -2 31 through 2 31-1. These are the highest and lowest values that
More informationCprE 288 Introduction to Embedded Systems Exam 1 Review. 1
CprE 288 Introduction to Embedded Systems Exam 1 Review http://class.ece.iastate.edu/cpre288 1 Overview of Today s Lecture Announcements Exam 1 Review http://class.ece.iastate.edu/cpre288 2 Announcements
More informationThe SPL Programming Language Reference Manual
The SPL Programming Language Reference Manual Leonidas Fegaras University of Texas at Arlington Arlington, TX 76019 fegaras@cse.uta.edu February 27, 2018 1 Introduction The SPL language is a Small Programming
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 informationOperators in C. Staff Incharge: S.Sasirekha
Operators in C Staff Incharge: S.Sasirekha Operators An operator is a symbol which helps the user to command the computer to do a certain mathematical or logical manipulations. Operators are used in C
More informationCSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York
CSc 10200! Introduction to Computing Lecture 2-3 Edgardo Molina Fall 2013 City College of New York 1 C++ for Engineers and Scientists Third Edition Chapter 2 Problem Solving Using C++ 2 Objectives In this
More informationJava Primer 1: Types, Classes and Operators
Java Primer 1 3/18/14 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Java Primer 1: Types,
More informationCSC Java Programming, Fall Java Data Types and Control Constructs
CSC 243 - Java Programming, Fall 2016 Java Data Types and Control Constructs Java Types In general, a type is collection of possible values Main categories of Java types: Primitive/built-in Object/Reference
More information