JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)
|
|
- Abigail Kimberly Gregory
- 5 years ago
- Views:
Transcription
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)
2 AGENDA 4. Type Values and Conversion 5. Variables 6. Operators and Expressions
3 Type Values and Conversion 4.
4 4.1 BOOLEAN VALUES 31 Boolean value represents truth or falsehood, on or off, yes or no Boolean values are generally the result of comparisons in JavaScript programs: If value is 4, the comparison is true Otherwise it is false Boolean values are commonly used in JavaScript control structures, such as If/else, etc. You combine a comparison expression directly with the statement, such as an If statement
5 4.1 BOOLEAN VALUES 32 Any JavaScript value can be converted to a Boolean value Following values evaluate to false or falsy: All other values, including all objects (and arrays) convert to, and work like, true (truthy) Boolean values have one method: tostring() true, false 3 important operators:
6 4.2 JAVASCRIPT SPECIAL VALUES 33 Null is a language keyword that evaluates to a special value that is usually used to indicate the absence of a value Undefined value (predefined global variable) represents a deeper kind of absence: Variables that have not been initialized Query an object property or array element that does not exist Function with no return value Despite these differences, null and undefined both indicate an absence of value and can often be used interchangeably:
7 4.2 JAVASCRIPT SPECIAL VALUES 34 General usage: Use undefined to represent a system-level, unexpected, or error-like absence of value Use null to represent program-level, normal, or expected absence of value
8 4.3 JAVASCRIPT GLOBAL OBJECT 35 Properties of global object are globally defined symbols available to a JavaScript program When JavaScript interpreter starts (i.e.web browser loads page), it creates a new global object and defines following properties: In top-level code (JavaScript not part of a function) use the JavaScript keyword this to refer to the global object In client-side JavaScript: Window object serves as the global object for all JavaScript code contained in the browser window it represents Global object holds predefined global values as well as program-defined global values, such as a global variable
9 4.4 JAVASCRIPT WRAPPER OBJECTS 36 JavaScript objects are composite values collection of properties or named values: Use. notation for value of property When value is a function, then property is a method To invoke the method m of an object o, we write o.m() Strings, numbers, and Booleans are not objects, so why do they have properties? JavaScript temporarily converts them into objects so that properties and methods can be used No wrapper objects for null and undefined
10 4.4 JAVASCRIPT WRAPPER OBJECTS 37 Strings, numbers, and Boolean values behave like objects when you try to read the value of a property (or method) from them But setting (= writing) a property value is silently ignored When reading properties temporary (wrapper) objects JavaScript converts wrapper objects into the wrapped primitive value as necessary objects S, N, and B usually behave just like the values s, n, and b Wrapper object == primitive value, to differentiate use strict equal operator (===) or typeof operator
11 4.5 TYPE CONVERSION 38 JavaScript is very flexible about the types of values it requires Truthy values convert to true, whereas falsy automatically convert to false Implicit conversion takes place!
12 4.5 TYPE CONVERSION 39
13 4.5 TYPE CONVERSION 40 Equality and Conversion Because JavaScript can convert values flexibly, its equality (==) operator is also flexible with its notion of equality All comparisons are true: == equality operator performs some conversion (covered later) === strict equality operator does not perform any conversion Convertibility of one value to another does not imply equality of those two values:
14 4.5 TYPE CONVERSION 41 Explicit Conversions In most cases, explicit conversion is desired cleaner code Easiest way to perform an explicit type conversion: Every value (except null/undefined) has a tostring() method Result of tostring() method is usually the same as that returned by the String() function Certain operators perform implicit type conversions sometimes used for the purposes of type conversion:
15 4.5 TYPE CONVERSION 42 Formatting/parsing numbers are common in computer programs: JavaScript has specialized functions and methods that provide more precise control over number-to-string and string-to-number conversions tostring() method defined by the Number class accepts an optional argument that specifies a radix (base) for the conversion (if left blank base 10) Number class defines 3 methods for number-to-string conversions: If a string value is passed to Number() function, it attempts to parse that string as an integer or floating-point literal (works only for base-10 integers)
16 4.5 TYPE CONVERSION 43 parseint() and parsefloat() global functions are more flexible:
17 4.5 TYPE CONVERSION 44 Object to Primitive Types Conversion Object conversions to other types are more complex: Object-to-Boolean conversions are trivial: all objects (including arrays and functions) convert to true Object-to-string and object-to-number conversions are performed by invoking a method of the object to be converted: Complicated due to the fact that JavaScript objects have two different methods that perform conversions Also complicated by some special cases described below All objects inherit two conversion methods: tostring() Method Returns a string representation of the object Many classes define more specific versions of the tostring() method: Array, Date, Function
18 4.5 TYPE CONVERSION 45 valueof() Method: Its job is less defined Supposed to convert an object to a primitive value that represents the object, if any such primitive value exists Arrays, functions, and regular expressions simply inherit the default method, which returns the object itself Date class defines a valueof() method that returns the date in its internal representation: Number of milliseconds since January 1, 1970
19 Variables 5.
20 5.1 VARIABLE DECLARATION 46 A variable is a named memory location Before using a variable in a JavaScript program, you should declare it You can declare multiple variables with one var: And you can combine variable declaration with initialization: When no initial value for a variable with the var statement is specified variable is declared, but its value is undefined until your code stores a value into it var statement also as part of the for and for/in loops:
21 5.1 VARIABLE DECLARATION 47 No type associated with JavaScript s variable declarations JavaScript variable can hold a value of any type (loosely typed) Perfectly legal in JavaScript to assign first a number to a variable, then later assign a string to that variable Following rules exist: Omitting the var keyword still creates a global variable not good practice and a source of bugs You should organize your variables based on what kind of data they will hold in your program (pseudo data type)
22 5.2 VARIABLE SCOPE 48 Scope is region of your source code in which variable is defined: Global variable; it is defined everywhere in your JavaScript code Variables declared in a function are local variables (local scope) Function parameters are also local variables, defined only within the body of the function Local variable takes precedence over a global variable with the same name (within function)
23 5.2 VARIABLE SCOPE 49 var is optional for global scope, but required for local variables, otherwise a locally intended variable becomes automatically global Consider what happens if you do not: Each function has its own scope, possible to have several nested layers of scope
24 5.2 VARIABLE SCOPE 50 In other programming languages, code within curly braces has its own scope, and variables are not visible outside of the block in which they are declared block scope JavaScript uses only function scope where variables are: visible within the function in which they are defined visible within any functions that are nested within that function All variables declared in a function are visible throughout the body of function This means that variables are even visible before they are declared! hoisting: JavaScript code behaves as if all variable declarations in a function (but not any associated assignments) are hoisted to the top of the function Local variable is defined throughout the body of the function, which means the global variable by the same name is hidden throughout the function Declare all variables at the top of a function, rather than to declare them closer to the point at which they are used
25 5.3 GLOBAL OBJECT AND VARIABLES 51 Global JavaScript variable is a property of the global object: Variable declaration with keyword var: property that is created is nonconfigurable cannot delete it! Variable declaration without keyword var: When assigning a value to an undeclared variable, JavaScript automatically creates a global variable for you that is configurable can delete it! Local variables are properties of an object associated with each function invocation JavaScript is a lexically (vs. dynamically) scoped language: Scope of a variable can be thought of as the set of source code lines for which the variable is defined Variable is defined by its location within the source code (it is apparent lexically) and nested functions have access to variables declared in their outer scope
26 5.3 GLOBAL OBJECT AND VARIABLES 52 JavaScript code (global code, functions) scope chain Scope chain is a list or chain of objects that defines the variables that are in scope JavaScript looks up value of variable x (variable resolution), it starts at the top of chain looking for property x in the object until it finds the first occurrence( if none found ReferenceError): When function is invoked, it creates a new object to store its local variables added to the stored scope chain to create a new, longer, chain that represents the scope for that function invocation
27 Operators and Expressions 6.
28 6. OPERATORS AND EXPRESSIONS 53 Complex expressions are built from simpler expressions: Array access expression consists of one expression that evaluates to an array followed by an open square bracket, an expression that evaluates to an integer, and a close square bracket (i.e. arr[2] ) Function invocation expression consists of one expression that evaluates to a function object and zero or more additional expressions that are used as the arguments to the function (i.e. ftest(4, test ) ) Common way to build a complex expression out of simpler expressions is with an operator: +, -, *, / Operators are used for JavaScript s arithmetic expressions, comparison expressions, logical expressions, assignment expressions, and more
29 6.1 OVERVIEW OF JAVASCRIPT OPERATORS 54 Most operators are represented by punctuation characters Some are represented by keywords (delete, instanceof) Number of Operands Operators can be categorized based on the number of operands they expect (their arity): Operand and Result Type Some operators work on values of any type But most expect their operands to be of a specific type And most operators return (or evaluate to) a value of a specific type (result type)
30 6.1 OVERVIEW OF JAVASCRIPT OPERATORS 55 Order by operator precedence Thick horizontal line separates precedence levels Column A: Operator associativity (L left to right, R right to left) Type lists the expected types of the operands and (after the symbol) the result type for the operator lval can legally appear on left side of assignment expression (vars, properties, array elements)
31 6.1 OVERVIEW OF JAVASCRIPT OPERATORS 56 JavaScript operators usually convert the type of their operands as needed (implicit conversion): 5 * 3 = 15 Every JavaScript value is either truthy or falsy, so operators that expect Boolean operands will work with an operand of any type Some operators behave differently depending on type, i.e. +: If numbers arithmetic addition If strings string concatenation (unfortunately confusing) Operator Precedence Operators with higher precedence are performed before those with lower precedence Assignment operator has lower precedence than * and + performed last Use parentheses to override order of precedence
32 6.1 OVERVIEW OF JAVASCRIPT OPERATORS 57 Property access and invocation expressions have higher precedence than any of the operators listed in previous Table! If unsure about the precedence of operators, simply use parentheses to make the evaluation order explicit Operator Associativity The associativity of an operator specifies the order in which operations of the same precedence are performed Value of L = left right R = right left
33 6.2 ARITHMETIC EXPRESSIONS 58 Basic arithmetic operators are: * (multiplication), / (division), % (modulo: remainder after division), + (addition), - (subtraction) Non-numeric operands that cannot convert to numbers convert to the NaN value If either operand is (or converts to) NaN, the result of the operation is also NaN The + Operator The binary + operator: adds numeric operands or concatenates string operands
34 6.2 ARITHMETIC EXPRESSIONS 59 When + operator is used with string and numbers, it may not be associative result depends on order of operation Unary Arithmetic Operators Unary operators modify the value of a single operand to produce a new value High precedence and right associative
35 6.2 ARITHMETIC EXPRESSIONS 60 Unary Operators: Return value of ++/-- operator depends on its position relative to the operand: Warning: Expression ++x is not always the same as x=x+1 ++ operator never performs string concatenation: it always converts its operand to a number and increments it If x is the string 1, ++x is the number 2, but x+1 is the string 11
36 6.3 RELATIONAL EXPRESSIONS 61 Relational operators test for a relationship (such as equals, less than, or property of ) between two values return true or false depending on whether that relationship exists Equality and Inequality Operators == and === check whether two values are the same using two different definitions of sameness === Strict equality == Less strict equality!= and!== tests for the exact opposite (! is Boolean NOT): Objects are compared by reference, not by value! Object is equal to itself, but not to any other object
37 6.3 RELATIONAL EXPRESSIONS 61 Strict equality operator evaluates its operands, then compares the two values performing no type conversion: Equality operator is like the strict equality operator, but it is less strict attempts some type conversion before comparing!
38 6.3 RELATIONAL EXPRESSIONS 63 Expression using equality operator evaluates to true, indicating that these very different-looking values are equal! Using strict equal operator values are indeed different
39 6.3 RELATIONAL EXPRESSIONS 64 Comparison Operators Operands may be of any type But comparison can be performed only on number and strings Operands that are not strings or numbers are converted Comparisons and conversion occurs as follows:
40 6.3 RELATIONAL EXPRESSIONS 65 Strings are sequences of 16-bit integer values comparison of numerical values in the string Numerical encoding order defined by Unicode may not match the traditional collation order used in any particular language or locale Use String.localeCompare() for a more robust string-comparison algorithm Use String.toLowerCase() and String.toUpperCase() for caseinsensitive comparision
41 6.3 RELATIONAL EXPRESSIONS 66 IN Operator in operator expects a left-side operand that is or can be converted to a string It expects a right-side operand that is an object It evaluates to true if the left-side value is the name of a property of the right-side object instanceof Operator The instanceof operator expects a left-side operand that is an object and a right-side operand that identifies a class of objects The operator evaluates to true if left-side object is an instance of the right-side class Evaluates to false otherwise
42 6.4 LOGICAL EXPRESSIONS 67 Logical AND (&&) The && operator can be understood at 3 different levels: 1 st Level: When used with Boolean operands, && performs the Boolean AND operation on the two values: Returns true if and only if both its first and second operand are true If one or both of these operands is false, it returns false But && does not require that its operands be Boolean values Recall that all JavaScript values are either truthy or falsy 2 nd Level: && can be understood as a Boolean AND operator for truthy and falsy values 3 rd Level: Starts by evaluating its first operand, the expression on its left: If the value on the left is falsy, entire expression is falsy, returns left value (and does not even evaluate right value) If the value on the left is truthy evaluates and returns right value
43 6.4 LOGICAL EXPRESSIONS 68 It is important to understand that && may or may not evaluate right-side operand Behavior of && is sometimes called short circuiting behavior is sometimes exploited: Careful when writing expressions with side effects on right side!! Logical OR ( ) The operator performs the Boolean OR operation on its two operands: If one or both operands is truthy, it returns a truthy value If both operands are falsy, it returns a falsy value Also complex behavior: Starts by evaluating its first operand (expression on the left) If the value of this first operand is truthy, it returns that truthy value Otherwise, it evaluates its second operand (expression on the right), and returns the value of that expression
44 6.4 LOGICAL EXPRESSIONS 69 Logical NOT (!)! operator is a unary operator; placed before a single operand Its purpose is to invert the Boolean value of its operand Unlike the && and operators, the! operator converts its operand to a Boolean value before inverting the converted value This means that! always returns true or false As a unary operator,! has high precedence and binds tightly If you want to invert the value of an expression like p && q, you need to use parentheses:!(p && q) It is worth noting two theorems of Boolean algebra here that we can express using JavaScript syntax:
45 6.5 ASSIGNMENT EXPRESSIONS 70 Use the = operator to assign a value to a variable or property = operator expects its left-side operand to be an lvalue: a variable or object property (or array element) Expects its right-side operand to be an arbitrary value of any type Value of an assignment expression is the value of the right-side operand! Assignment expression as part of a larger a expression: Assignment operator has right-to-left associativity when multiple assignment operators appear in an expression, they are evaluated from right to left
46 6.5 ASSIGNMENT EXPRESSIONS 71 Assignment with Operation += operator performs addition and assignment += operator works for numbers or strings Numbers addition, then assignment Strings concatenation, then assignment
47 6.5 ASSIGNMENT EXPRESSIONS 72 First line, expression a is evaluated once Second line a is evaluated twice The two cases will only differ if a includes side effects: function call, increment operator Example shows that two assignments are not the same:
48 6.6 MISCELLANEOUS OPERATORS 73 Conditional Operator (? :) The only ternary operator (three operands) Three operands: First goes before the? Second goes between the? and the : Third goes after the : First operand is evaluated and interpreted as a Boolean: If first operand is truthy, then the second operand is evaluated, and its value is returned If first operand is falsy, then the third operand is evaluated and its value is returned
49 6.6 MISCELLANEOUS OPERATORS 74 typeof Operator typeof is a unary operator that is placed before its single operand, which can be of any type typeof operator is also useful when used with the switch statement You can place parentheses around the operand to typeof looks like the name of a function rather than an operator keyword
50 6.6 MISCELLANEOUS OPERATORS 75 Note that typeof returns object if the operand value is null typeof may return a string other than object for host objects Because typeof evaluates to object for all object and array values other than functions, it is useful only to distinguish objects from other, primitive types In order to distinguish one class of object from another, you must use other techniques, such as the instanceof operator, the class attribute, or the constructor property Although functions in JavaScript are a kind of object, the typeof operator considers functions to be sufficiently different that they have their own return value JavaScript makes a subtle distinction between functions and callable objects. All functions are callable, but it is possible to have a callable object that can be invoked just like a function that is not a true function
51 6.6 MISCELLANEOUS OPERATORS 76 delete Operator delete is a unary operator that attempts to delete the object property or array element specified as its operand Note that a deleted property or array element is not merely set to the undefined value When a property is deleted, the property ceases to exist: Attempting to read a nonexistent property returns undefined You can test for actual existence of property with the in operator Delete expects its operand to be an lvalue: If it is not an lvalue, the operator takes no action and returns true Otherwise, delete attempts to delete the specified lvalue delete returns true if it successfully deletes the specified lvalue
52 6.6 MISCELLANEOUS OPERATORS 77 void Operator void is a unary operator: appears before a single operand, which may be of any type Unusual and infrequently used: it evaluates its operand, then discards the value and returns undefined Comma Operator (,) Binary operator whose operands may be of any type Evaluates its left operand, evaluates its right operand, and then returns the value of the right operand Left-hand expression is always evaluated, but its value is discarded Only makes sense to use the comma operator when the left-hand expression has side effects
JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)
Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 4 Professional Program: Data Administration and Management JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) AGENDA
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 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 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 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 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 informationExpr Language Reference
Expr Language Reference Expr language defines expressions, which are evaluated in the context of an item in some structure. This article describes the syntax of the language and the rules that govern the
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 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 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 informationIntroduction to Visual Basic and Visual C++ Arithmetic Expression. Arithmetic Expression. Using Arithmetic Expression. Lesson 4.
Introduction to Visual Basic and Visual C++ Arithmetic Expression Lesson 4 Calculation I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Arithmetic Expression Using Arithmetic Expression Calculations
More informationThe PCAT Programming Language Reference Manual
The PCAT Programming Language Reference Manual Andrew Tolmach and Jingke Li Dept. of Computer Science Portland State University September 27, 1995 (revised October 15, 2002) 1 Introduction The PCAT language
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 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 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 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 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 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 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 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: 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 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 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 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 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 informationRuby: Introduction, Basics
Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 3 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie
More informationRuby: Introduction, Basics
Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 4 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie
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 informationInformation Science 1
Information Science 1 Simple Calcula,ons Week 09 College of Information Science and Engineering Ritsumeikan University Topics covered l Terms and concepts from Week 8 l Simple calculations Documenting
More informationIPCoreL. Phillip Duane Douglas, Jr. 11/3/2010
IPCoreL Programming Language Reference Manual Phillip Duane Douglas, Jr. 11/3/2010 The IPCoreL Programming Language Reference Manual provides concise information about the grammar, syntax, semantics, and
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 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 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 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 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 informationUnit 3. Operators. School of Science and Technology INTRODUCTION
INTRODUCTION Operators Unit 3 In the previous units (unit 1 and 2) you have learned about the basics of computer programming, different data types, constants, keywords and basic structure of a C program.
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 informationChapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics
Java Programming, Sixth Edition 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional Projects Additional
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 informationARG! Language Reference Manual
ARG! Language Reference Manual Ryan Eagan, Mike Goldin, River Keefer, Shivangi Saxena 1. Introduction ARG is a language to be used to make programming a less frustrating experience. It is similar to C
More informationReview Chapters 1 to 4. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013
Review Chapters 1 to 4 Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 Introduction to Java Chapters 1 and 2 The Java Language Section 1.1 Data & Expressions Sections 2.1 2.5 Instructor:
More informationObjectives. Chapter 4: Control Structures I (Selection) Objectives (cont d.) Control Structures. Control Structures (cont d.) Relational Operators
Objectives Chapter 4: Control Structures I (Selection) In this chapter, you will: Learn about control structures Examine relational and logical operators Explore how to form and evaluate logical (Boolean)
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 informationZhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson
Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Introduction History, Characteristics of Java language Java Language Basics Data types, Variables, Operators and Expressions Anatomy of a Java Program
More informationObject Oriented Software Design
Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 30, 2010 G. Lipari (Scuola Superiore Sant Anna) Introduction
More informationA Short Summary of Javali
A Short Summary of Javali October 15, 2015 1 Introduction Javali is a simple language based on ideas found in languages like C++ or Java. Its purpose is to serve as the source language for a simple compiler
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 informationChapter 4: Control Structures I (Selection) Objectives. Objectives (cont d.) Control Structures. Control Structures (cont d.
Chapter 4: Control Structures I (Selection) In this chapter, you will: Objectives Learn about control structures Examine relational and logical operators Explore how to form and evaluate logical (Boolean)
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 informationProgramming Lecture 3
Programming Lecture 3 Expressions (Chapter 3) Primitive types Aside: Context Free Grammars Constants, variables Identifiers Variable declarations Arithmetic expressions Operator precedence Assignment statements
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 informationWEEK 4 OPERATORS, EXPRESSIONS AND STATEMENTS
WEEK 4 OPERATORS, EXPRESSIONS AND STATEMENTS OPERATORS Review: Data values can appear as literals or be stored in variables/constants Data values can be returned by method calls Operators: special symbols
More informationSPARK-PL: Introduction
Alexey Solovyev Abstract All basic elements of SPARK-PL are introduced. Table of Contents 1. Introduction to SPARK-PL... 1 2. Alphabet of SPARK-PL... 3 3. Types and variables... 3 4. SPARK-PL basic commands...
More informationCh. 12: Operator Overloading
Ch. 12: Operator Overloading Operator overloading is just syntactic sugar, i.e. another way to make a function call: shift_left(42, 3); 42
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 informationRuby: Introduction, Basics
Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 4 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie
More informationProgramming Languages Third Edition. Chapter 9 Control I Expressions and Statements
Programming Languages Third Edition Chapter 9 Control I Expressions and Statements Objectives Understand expressions Understand conditional statements and guards Understand loops and variation on WHILE
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 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 informationControl Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003
Control Flow COMS W1007 Introduction to Computer Science Christopher Conway 3 June 2003 Overflow from Last Time: Why Types? Assembly code is typeless. You can take any 32 bits in memory, say this is an
More informationIntroduction To Java. Chapter 1. Origins of the Java Language. Origins of the Java Language. Objects and Methods. Origins of the Java Language
Chapter 1 Getting Started Introduction To Java Most people are familiar with Java as a language for Internet applications We will study Java as a general purpose programming language The syntax of expressions
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 informationCS4120/4121/5120/5121 Spring 2016 Xi Language Specification Cornell University Version of May 11, 2016
CS4120/4121/5120/5121 Spring 2016 Xi Language Specification Cornell University Version of May 11, 2016 In this course you will start by building a compiler for a language called Xi. This is an imperative,
More information4. Inputting data or messages to a function is called passing data to the function.
Test Bank for A First Book of ANSI C 4th Edition by Bronson Link full download test bank: http://testbankcollection.com/download/test-bank-for-a-first-book-of-ansi-c-4th-edition -by-bronson/ Link full
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 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 informationEDIABAS BEST/2 LANGUAGE DESCRIPTION. VERSION 6b. Electronic Diagnostic Basic System EDIABAS - BEST/2 LANGUAGE DESCRIPTION
EDIABAS Electronic Diagnostic Basic System BEST/2 LANGUAGE DESCRIPTION VERSION 6b Copyright BMW AG, created by Softing AG BEST2SPC.DOC CONTENTS CONTENTS...2 1. INTRODUCTION TO BEST/2...5 2. TEXT CONVENTIONS...6
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 informationLanguage Features. 1. The primitive types int, double, and boolean are part of the AP
Language Features 1. The primitive types int, double, and boolean are part of the AP short, long, byte, char, and float are not in the subset. In particular, students need not be aware that strings are
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 informationIC Language Specification
CS 301 Spring 2016 IC Language Specification The IC Language For the implementation project, you will build a compiler for an object-oriented language called IC (for Irish Coffee 1 ), which is essentially
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 information3. Java - Language Constructs I
Names and Identifiers A program (that is, a class) needs a name public class SudokuSolver {... 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations,
More informationCHAD Language Reference Manual
CHAD Language Reference Manual INTRODUCTION The CHAD programming language is a limited purpose programming language designed to allow teachers and students to quickly code algorithms involving arrays,
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 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 informationAbsolute C++ Walter Savitch
Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents
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 informationFull file at
Java Programming, Fifth Edition 2-1 Chapter 2 Using Data within a Program At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional
More informationCMPT 125: Lecture 3 Data and Expressions
CMPT 125: Lecture 3 Data and Expressions Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University January 3, 2009 1 Character Strings A character string is an object in Java,
More informationChapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. A Guide to this Instructor s Manual:
Java Programming, Eighth Edition 2-1 Chapter 2 Using Data A Guide to this Instructor s Manual: We have designed this Instructor s Manual to supplement and enhance your teaching experience through classroom
More informationInformation Science 1
Topics covered Information Science 1 Terms and concepts from Week 8 Simple calculations Documenting programs Simple Calcula,ons Expressions Arithmetic operators and arithmetic operator precedence Mixed-type
More informationModule 2 - Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1
Module 2 - Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1 Topics 1. Expressions 2. Operator precedence 3. Shorthand operators 4. Data/Type Conversion 1/15/19 CSE 1321 MODULE 2 2 Expressions
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 informationDecaf Language Reference
Decaf Language Reference Mike Lam, James Madison University Fall 2016 1 Introduction Decaf is an imperative language similar to Java or C, but is greatly simplified compared to those languages. It will
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 informationChapter 02: Using Data
True / False 1. A variable can hold more than one value at a time. ANSWER: False REFERENCES: 54 2. The int data type is the most commonly used integer type. ANSWER: True REFERENCES: 64 3. Multiplication,
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 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 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 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 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 informationFRAC: Language Reference Manual
FRAC: Language Reference Manual Justin Chiang jc4127 Kunal Kamath kak2211 Calvin Li ctl2124 Anne Zhang az2350 1. Introduction FRAC is a domain-specific programming language that enables the programmer
More informationThe Decaf Language. 1 Lexical considerations
The Decaf Language In this course, we will write a compiler for a simple object-oriented programming language called Decaf. Decaf is a strongly-typed, object-oriented language with support for inheritance
More informationCPS122 Lecture: From Python to Java
Objectives: CPS122 Lecture: From Python to Java last revised January 7, 2013 1. To introduce the notion of a compiled language 2. To introduce the notions of data type and a statically typed language 3.
More informationSingle-pass Static Semantic Check for Efficient Translation in YAPL
Single-pass Static Semantic Check for Efficient Translation in YAPL Zafiris Karaiskos, Panajotis Katsaros and Constantine Lazos Department of Informatics, Aristotle University Thessaloniki, 54124, Greece
More informationegrapher Language Reference Manual
egrapher Language Reference Manual Long Long: ll3078@columbia.edu Xinli Jia: xj2191@columbia.edu Jiefu Ying: jy2799@columbia.edu Linnan Wang: lw2645@columbia.edu Darren Chen: dsc2155@columbia.edu 1. Introduction
More informationAbout Codefrux While the current trends around the world are based on the internet, mobile and its applications, we try to make the most out of it. As for us, we are a well established IT professionals
More information