JAVASCRIPT BASICS. Type-Conversion in JavaScript. Type conversion or typecasting is one of the very important concept in

Size: px
Start display at page:

Download "JAVASCRIPT BASICS. Type-Conversion in JavaScript. Type conversion or typecasting is one of the very important concept in"

Transcription

1 Type-Conversion in JavaScript Description Type conversion or typecasting is one of the very important concept in JavaScript. It refers to changing an entity or variable from one datatype to another. There are two types of conversion: 1. Implicit Conversion - Coercion 2. Explicit Conversion - casting The term for implicit type conversion is coercion. Explicit type conversion in some specific way is known as casting. Implicit type conversion Implicit type conversion, also termed as coercion, is an automatic type conversion from one data type to another data type by the compiler itself. In mixed type expression, a subtype s will be converted to a supertype t or some subtypes s1, s2,... will be converted to a supertype t at runtime so that the program will run correctly. For example:

2 var x = 123; x ; The above statement recognized by the compiler for x as 123 which is a number and we will get the value as = 223 (Addition operation is happening in this area) Sample code <! DOCTYPE html> <html> <body> <p>wikitechy - JavaScript Data Type Conversion </p> <p id="wikitechy_text"></p> <script> var x = 100; document.getelementbyid("wikitechy_text").innerhtml = x+100; </script> </body> </html> Let s try with an another example, now the value of x is a var x = 'a'; x+100; The above line will recognize x as a character or string and the output is a100 (String Concatenation happening in this)

3 Sample code <! DOCTYPE html> <html> <body> <p>wikitechy - Javascript Data Type Conversion </p> <p id="wikitechy_text"></p> <script> var x = abc; document.getelementbyid("wikitechy_text").innerhtml =x+100; </script> </body> </html> Explicit type conversion In this case, an explicit type conversion will happen. The variables will be explicitly converted from one type to another type. For Example: parseint("3.14") - > This function will parse the value given in the brackets and convert in to integer. So, the output of the above command is 3. String(Date()) -> Get current date and time and convert it into String.

4 Sample code <!DOCTYPE html> <html> <body> <p>wikitechy - Javascript Data Type Conversion </p> <p id="wikitechy_text"></p> <script> var x = 123; document.getelementbyid("wikitechy_text").innerhtml = String(x) + "<br>" + String(123) + "<br>" + String( )+ "<br>" + "<br>"+ "<br>"+ "<br>"+ x.tostring()+ "<br>" + (123).toString()+ "<br>" + ( ).toString()+ "<br>" + "<br>"+ String(Date())+ "<br>" + Date().toString()+ "<br>" + "<br>"+ "<br>"+ </script> </body> </html> Number("3.14") + "<br>" + parsefloat("3.14")+ "<br>" + parseint("3.14");

5 Code Explanation: JAVASCRIPT BASICS Paragraph tag displaying the text WikiTechy - Javascript Arraus Paragraph tag in which we are trying to get the result. The id of the paragraph tag is, WikiTechy_Text <p id="wikitechy_text"></p> Script tag -> Entire JavaScript functions and variables needs to be declared between the tags. <script>.</script> Initialize the variable x var; x = 123;

6 Trying to fetch the element in the HTML WikiTechy_Text and accessing the innerhtml value and assign the properties of the object. Type casting of the variable x into String. Variable assigning method String(x) + "<br>" + The output will be 123 String(123) + "<br>" + The output will be 123 String( )+ "<br>" + "<br>"+ "<br>"+ The output will be 123 Type casting of the variable x into String using tostring() method. x.tostring()+ "<br>" + The output will be 123 (123).toString()+ "<br>" + The output will be 123 ( ).toString() + "<br>" + "<br>"+ "<br>"+ The output will be 123 Type casting of the variable x into String using tostring() method. String(Date())+ "<br>" + -> The output is Thu Apr :57:02 GMT+0530 (India Standard Time) Date().toString()+ "<br>" + "<br>"+ "<br>" -> The output is Thu Apr :57:02 GMT+0530 (India Standard Time) Type Conversion for numbers. Trying to get the integers and float values in the below code Number("3.14") + "<br>" + -> The output is a number 3.14 parsefloat("3.14")+ "<br>" + -> The output is a number 3.14 parseint("3.14"); -> The output is a number 3

7 Sample Output: JAVASCRIPT BASICS

8 Output:

9 Displaying the text WikiTechy - JavaScript Arrays in the paragraph tag of the HTML page. Displaying the result String(x) + "<br>" + The output will be 123 String(123) + "<br>" + The output will be 123 String( )+ "<br>" + "<br>"+ "<br>"+ The output will be 123 Displaying the next result x.tostring()+ "<br>" + The output will be 123 (123).toString()+ "<br>" + The output will be 123 (100+23).toString() + "<br>" + "<br>"+ "<br>"+ The output will be 123 Displaying the date values String(Date())+ "<br>" + -> The output is Thu Apr :57:02 GMT+0530 (India Standard Time) Date().toString()+ "<br>" + "<br>"+ "<br>" -> The output is Thu Apr :57:02 GMT+0530 (India Standard Time) Displaying the number values Number("3.14") + "<br>" + -> The output is a number 3.14 parsefloat("3.14")+ "<br>" + -> The output is a number 3.14 parseint("3.14"); -> The output is a number 3

CSC Web Programming. Introduction to JavaScript

CSC 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 information

JAVASCRIPT BASICS. JavaScript String Functions. Here is the basic condition you have to follow. If you start a string with

JAVASCRIPT BASICS. JavaScript String Functions. Here is the basic condition you have to follow. If you start a string with JavaScript String Functions Description String constants can be specified by enclosing characters or strings within double quotes, e.g. "WikiTechy is the best site to learn JavaScript". A string constant

More information

COMP284 Scripting Languages Lecture 14: JavaScript (Part 1) Handouts

COMP284 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 information

COMP519 Web Programming Lecture 12: JavaScript (Part 3) Handouts

COMP519 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 information

HTML5 and CSS3 More JavaScript Page 1

HTML5 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 information

CSE 431S Type Checking. Washington University Spring 2013

CSE 431S Type Checking. Washington University Spring 2013 CSE 431S Type Checking Washington University Spring 2013 Type Checking When are types checked? Statically at compile time Compiler does type checking during compilation Ideally eliminate runtime checks

More information

JavaScript CS 4640 Programming Languages for Web Applications

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 information

Data Types. Every program uses data, either explicitly or implicitly to arrive at a result.

Data Types. Every program uses data, either explicitly or implicitly to arrive at a result. Every program uses data, either explicitly or implicitly to arrive at a result. Data in a program is collected into data structures, and is manipulated by algorithms. Algorithms + Data Structures = Programs

More information

JavaScript: The Basics

JavaScript: 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 information

c122mar413.notebook March 06, 2013

c122mar413.notebook March 06, 2013 These are the programs I am going to cover today. 1 2 Javascript is embedded in HTML. The document.write() will write the literal Hello World! to the web page document. Then the alert() puts out a pop

More information

CSI33 Data Structures

CSI33 Data Structures Outline Department of Mathematics and Computer Science Bronx Community College October 24, 2018 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers Expressions and Operator Precedence

More information

Exercise 1: Basic HTML and JavaScript

Exercise 1: Basic HTML and JavaScript Exercise 1: Basic HTML and JavaScript Question 1: Table Create HTML markup that produces the table as shown in Figure 1. Figure 1 Question 2: Spacing Spacing can be added using CellSpacing and CellPadding

More information

JavaScript CS 4640 Programming Languages for Web Applications

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 information

Type Conversion. and. Statements

Type Conversion. and. Statements and Statements Type conversion changing a value from one type to another Void Integral Floating Point Derived Boolean Character Integer Real Imaginary Complex no fractional part fractional part 2 tj Suppose

More information

Topic 9: Type Checking

Topic 9: Type Checking Recommended Exercises and Readings Topic 9: Type Checking From Haskell: The craft of functional programming (3 rd Ed.) Exercises: 13.17, 13.18, 13.19, 13.20, 13.21, 13.22 Readings: Chapter 13.5, 13.6 and

More information

Topic 9: Type Checking

Topic 9: Type Checking Topic 9: Type Checking 1 Recommended Exercises and Readings From Haskell: The craft of functional programming (3 rd Ed.) Exercises: 13.17, 13.18, 13.19, 13.20, 13.21, 13.22 Readings: Chapter 13.5, 13.6

More information

Such JavaScript Very Wow

Such 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 information

introjs.notebook March 02, 2014

introjs.notebook March 02, 2014 1 document.write() uses the write method to write on the document. It writes the literal Hello World! which is enclosed in quotes since it is a literal and then enclosed in the () of the write method.

More information

Programming language components

Programming language components Programming language components syntax: grammar rules for defining legal statements what's grammatically legal? how are things built up from smaller things? semantics: what things mean what do they compute?

More information

Types. What is a type?

Types. What is a type? Types What is a type? Type checking Type conversion Aggregates: strings, arrays, structures Enumeration types Subtypes Types, CS314 Fall 01 BGRyder 1 What is a type? A set of values and the valid operations

More information

Module 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 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 information

COMS 469: Interactive Media II

COMS 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 information

Type Analysis. Type Checking vs. Type Inference

Type Analysis. Type Checking vs. Type Inference Type Analysis Is an operator applied to an incompatible operand? Type checking: Static: Check for type compatibility at compile time Dynamic: Check for type compatibility at run time Type analysis phase

More information

Midterm CSE 131B Spring 2005

Midterm CSE 131B Spring 2005 Signature Login Name _ Name Student ID Midterm CSE 131B Spring 2005 Page 1 Page 2 Page 3 Page 4 Page 5 (20 points) (18 points) (22 points) (20 points) (20 points) Subtotal Page 6 Extra Credit (100 points)

More information

Expressions and Casting. Data Manipulation. Simple Program 11/5/2013

Expressions and Casting. Data Manipulation. Simple Program 11/5/2013 Expressions and Casting C# Programming Rob Miles Data Manipulation We know that programs use data storage (variables) to hold values and statements to process the data The statements are obeyed in sequence

More information

3 The Building Blocks: Data Types, Literals, and Variables

3 The Building Blocks: Data Types, Literals, and Variables chapter 3 The Building Blocks: Data Types, Literals, and Variables 3.1 Data Types A program can do many things, including calculations, sorting names, preparing phone lists, displaying images, validating

More information

Expressions and Casting

Expressions and Casting Expressions and Casting C# Programming Rob Miles Data Manipulation We know that programs use data storage (variables) to hold values and statements to process the data The statements are obeyed in sequence

More information

Subtyping (cont) Formalization of Subtyping. Lecture 15 CS 565. Inversion of the subtype relation:

Subtyping (cont) Formalization of Subtyping. Lecture 15 CS 565. Inversion of the subtype relation: Subtyping (cont) Lecture 15 CS 565 Formalization of Subtyping Inversion of the subtype relation:! If "

More information

A.A. 2008/09. Why introduce JavaScript. G. Cecchetti Internet Software Technologies

A.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 information

JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)

JAVASCRIPT 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 information

Chapter 2: Using Data

Chapter 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 information

Bitwise Operator and Typecasting

Bitwise Operator and Typecasting Bitwise Operator and Data and File Structures Laboratory http://www.isical.ac.in/~dfslab/2017/index.html Indian Statistical Institute Kolkata August 17, 2017 DFS Lab, ISI Kolkata Bitwise Operator and August

More information

JAVASCRIPT BASICS. JavaScript Math Functions. The Math functions helps you to perform mathematical tasks

JAVASCRIPT BASICS. JavaScript Math Functions. The Math functions helps you to perform mathematical tasks JavaScript Math Functions Functions The Math functions helps you to perform mathematical tasks in a very way and lot of inbuilt mathematical functions which makes the programmers life easier. Typical example

More information

Client-Side Web Technologies. JavaScript Part I

Client-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 information

JavaScript: Introduction, Types

JavaScript: Introduction, Types JavaScript: Introduction, Types Computer Science and Engineering College of Engineering The Ohio State University Lecture 19 History Developed by Netscape "LiveScript", then renamed "JavaScript" Nothing

More information

COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2017)

COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2017) COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2017) RAMANA ISUKAPALLI RAMANA@CS.COLUMBIA.EDU 1 LECTURE-1 Course overview See http://www.cs.columbia.edu/~ramana Overview of HTML Formatting, headings,

More information

PES DEGREE COLLEGE BANGALORE SOUTH CAMPUS 1 K.M. before Electronic City, Bangalore WEB PROGRAMMING Solution Set II

PES DEGREE COLLEGE BANGALORE SOUTH CAMPUS 1 K.M. before Electronic City, Bangalore WEB PROGRAMMING Solution Set II PES DEGREE COLLEGE BANGALORE SOUTH CAMPUS 1 K.M. before Electronic City, Bangalore 560 100 WEB PROGRAMMING Solution Set II Section A 1. This function evaluates a string as javascript statement or expression

More information

Information Science 1

Information 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 information

ORB Education Quality Teaching Resources

ORB Education Quality Teaching Resources JavaScript is one of the programming languages that make things happen in a web page. It is a fantastic way for students to get to grips with some of the basics of programming, whilst opening the door

More information

Subtyping (cont) Lecture 15 CS 565 4/3/08

Subtyping (cont) Lecture 15 CS 565 4/3/08 Subtyping (cont) Lecture 15 CS 565 4/3/08 Formalization of Subtyping Inversion of the subtype relation: If σ

More information

Coding in JavaScript functions

Coding in JavaScript functions Coding in JavaScript functions A function contains code that will be executed by an event or by a call to the function. You may call a function from anywhere within a page (or even from other pages if

More information

9/7/17. Outline. Name, Scope and Binding. Names. Introduction. Names (continued) Names (continued) In Text: Chapter 5

9/7/17. Outline. Name, Scope and Binding. Names. Introduction. Names (continued) Names (continued) In Text: Chapter 5 Outline Name, Scope and Binding In Text: Chapter 5 Names Variable Binding Type bindings, type conversion Storage bindings and lifetime Scope Lifetime vs. Scope Referencing Environments N. Meng, S. Arthur

More information

Introduction to Programming Using Java (98-388)

Introduction 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 information

C-LANGUAGE CURRICULAM

C-LANGUAGE CURRICULAM C-LANGUAGE CURRICULAM Duration: 2 Months. 1. Introducing C 1.1 History of C Origin Standardization C-Based Languages 1.2 Strengths and Weaknesses Of C Strengths Weaknesses Effective Use of C 2. C Fundamentals

More information

Interfaces. Java interface. Notes. Example of code duplication. Why an interface construct? Interfaces & Types. good software engineering

Interfaces. Java interface. Notes. Example of code duplication. Why an interface construct? Interfaces & Types. good software engineering Interfaces Interfaces & Types Lecture 9 CS211 Summer 2007 So far, we have talked about interfaces informally, in the English sense of the word an interface describes how a client interacts with a class

More information

3. Java - Language Constructs I

3. 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 information

Expressions & Assignment Statements

Expressions & Assignment Statements Expressions & Assignment Statements 1 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean Expressions Short-Circuit Evaluation Assignment Statements

More information

Lab 1. Purpose. Assignment. Action Items/Programming Requirements

Lab 1. Purpose. Assignment. Action Items/Programming Requirements Lab 1 Purpose To assess your ability to apply the knowledge and skills developed in weeks 1 through 4. Emphasis will be placed on the following learning outcomes: 1. Create and display simple syntactically

More information

Lecture 7: Type Systems and Symbol Tables. CS 540 George Mason University

Lecture 7: Type Systems and Symbol Tables. CS 540 George Mason University Lecture 7: Type Systems and Symbol Tables CS 540 George Mason University Static Analysis Compilers examine code to find semantic problems. Easy: undeclared variables, tag matching Difficult: preventing

More information

Principles of Programming Languages

Principles of Programming Languages Principles of Programming Languages h"p://www.di.unipi.it/~andrea/dida2ca/plp- 14/ Prof. Andrea Corradini Department of Computer Science, Pisa Lesson 23! Type systems Type safety Type checking Equivalence,

More information

A Type is a Set of Values. Here we declare n to be a variable of type int; what we mean, n can take on any value from the set of all integer values.

A Type is a Set of Values. Here we declare n to be a variable of type int; what we mean, n can take on any value from the set of all integer values. Types A Type is a Set of Values Consider the statement: Read Chapter 6 int n; Here we declare n to be a variable of type int; what we mean, n can take on any value from the set of all integer values. Also

More information

G Programming Languages Spring 2010 Lecture 6. Robert Grimm, New York University

G Programming Languages Spring 2010 Lecture 6. Robert Grimm, New York University G22.2110-001 Programming Languages Spring 2010 Lecture 6 Robert Grimm, New York University 1 Review Last week Function Languages Lambda Calculus SCHEME review 2 Outline Promises, promises, promises Types,

More information

Inheritance and object compatibility

Inheritance and object compatibility Inheritance and object compatibility Object type compatibility An instance of a subclass can be used instead of an instance of the superclass, but not the other way around Examples: reference/pointer can

More information

Web Programming and Design. MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh

Web Programming and Design. MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh Web Programming and Design MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh Plan for the next 5 weeks: Introduction to HTML tags, creating our template file Introduction to CSS and style

More information

Lab 1 Concert Ticket Calculator

Lab 1 Concert Ticket Calculator Lab 1 Concert Ticket Calculator Purpose To assess your ability to apply the knowledge and skills developed in weeks 1 through 3. Emphasis will be placed on the following learning outcomes: 1. Create and

More information

INDEX. A SIMPLE JAVA PROGRAM Class Declaration The Main Line. The Line Contains Three Keywords The Output Line

INDEX. A SIMPLE JAVA PROGRAM Class Declaration The Main Line. The Line Contains Three Keywords The Output Line A SIMPLE JAVA PROGRAM Class Declaration The Main Line INDEX The Line Contains Three Keywords The Output Line COMMENTS Single Line Comment Multiline Comment Documentation Comment TYPE CASTING Implicit Type

More information

B. V. Patel Institute of BMC & IT 2014

B. V. Patel Institute of BMC & IT 2014 Unit 1: Introduction Short Questions: 1. What are the rules for writing PHP code block? 2. Explain comments in your program. What is the purpose of comments in your program. 3. How to declare and use constants

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss 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 information

JAVASCRIPT LESSON 4: FUNCTIONS

JAVASCRIPT LESSON 4: FUNCTIONS JAVASCRIPT LESSON 4: FUNCTIONS 11.1 Introductio n Programs that solve realworld programs More complex than programs from previous chapters Best way to develop & maintain large program: Construct from small,

More information

Strict Inheritance. Object-Oriented Programming Spring 2008

Strict Inheritance. Object-Oriented Programming Spring 2008 Strict Inheritance Object-Oriented Programming 236703 Spring 2008 1 Varieties of Polymorphism P o l y m o r p h i s m A d h o c U n i v e r s a l C o e r c i o n O v e r l o a d i n g I n c l u s i o n

More information

C HAPTER S EVEN F OCUS ON J AVAS CRIPT AND VBSCRIPT E XTENSIONS

C HAPTER S EVEN F OCUS ON J AVAS CRIPT AND VBSCRIPT E XTENSIONS C HAPTER S EVEN F OCUS ON J AVAS CRIPT AND VBSCRIPT E XTENSIONS Among the more creative and interesting ways to enhance the Web store is through advanced HTML tags. Today, among the most advanced of these

More information

Chapter 5 Names, Binding, Type Checking and Scopes

Chapter 5 Names, Binding, Type Checking and Scopes Chapter 5 Names, Binding, Type Checking and Scopes Names - We discuss all user-defined names here - Design issues for names: -Maximum length? - Are connector characters allowed? - Are names case sensitive?

More information

Java Classes: Math, Integer A C S L E C T U R E 8

Java Classes: Math, Integer A C S L E C T U R E 8 Java Classes: Math, Integer A C S - 1903 L E C T U R E 8 Math class Math class is a utility class You cannot create an instance of Math All references to constants and methods will use the prefix Math.

More information

Lab 2 Population. Purpose. Assignment Lab 2 analyzes population growth of a town as well as compare the population growth of two towns.

Lab 2 Population. Purpose. Assignment Lab 2 analyzes population growth of a town as well as compare the population growth of two towns. Lab 2 Population Purpose To assess your ability to apply the knowledge and skills developed up though week 7. Emphasis will be placed on the following learning outcomes: 1. Decompose a problem into modularized

More information

CITS1231 Web Technologies. JavaScript Math, String, Array, Number, Debugging

CITS1231 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 information

CS-202 Introduction to Object Oriented Programming

CS-202 Introduction to Object Oriented Programming CS-202 Introduction to Object Oriented Programming California State University, Los Angeles Computer Science Department Lecture III Inheritance and Polymorphism Introduction to Inheritance Introduction

More information

Chapter 7. Expressions and Assignment Statements (updated edition 11) ISBN

Chapter 7. Expressions and Assignment Statements (updated edition 11) ISBN Chapter 7 Expressions and Assignment Statements (updated edition 11) ISBN 0-321-49362-1 Chapter 7 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean

More information

Inclusion Polymorphism

Inclusion Polymorphism 06D-1 Inclusion Polymorphism Polymorphic code Polymorphic references Up- and Down- Casting Polymorphism and values Polymorphic Arrays Inclusion Polymorphism in Context 06D-2 Polymorphism Ad hoc Universal

More information

Introduction to JavaScript Programming Test Bank Chapter 1 with XML and PHP

Introduction to JavaScript Programming Test Bank Chapter 1 with XML and PHP Test Bank for Introduction to JavaScript Programming 1 st Edition by rake Link download full: http://testbankcollection.com/download/test-bank-for-introduction-to-javascriptprogramming-with-xml-and-php-1st-edition-by-drake

More information

Introduction & Java Review. EE 564 Lecture 1

Introduction & Java Review. EE 564 Lecture 1 Introduction & Java Review EE 564 Lecture 1 Course Overview Personnel introduction Course plan: theory: OO design 1 month practice 1: eclipse ~1.5 months practice 2: Java EE ~1.5 months Plan to devote

More information

LECTURE-2. Functions review HTML Forms. Arrays Exceptions Events. CS3101: Scripting Languages: Javascript Ramana Isukapalli

LECTURE-2. Functions review HTML Forms. Arrays Exceptions Events. CS3101: Scripting Languages: Javascript Ramana Isukapalli LECTURE-2 Functions review HTML Forms Arrays Exceptions Events 1 JAVASCRIPT FUNCTIONS, REVIEW Syntax function (params) { // code Note: Parameters do NOT have variable type. 1. Recall: Function

More information

EECS1012. Net-centric Introduction to Computing. Lecture Introduction to Javascript

EECS1012. Net-centric Introduction to Computing. Lecture Introduction to Javascript EECS 1012 Net-centric Introduction to Computing Lecture Introduction to Javascript Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M. Stepp, J. Miller, and

More information

Binghamton University. CS-140 Fall Dynamic Types

Binghamton University. CS-140 Fall Dynamic Types Dynamic Types 1 Assignment to a subtype If public Duck extends Bird { Then, you may code:. } Bird bref; Duck quack = new Duck(); bref = quack; A subtype may be assigned where the supertype is expected

More information

Introduction to Visual Basic and Visual C++ Arithmetic Expression. Arithmetic Expression. Using Arithmetic Expression. Lesson 4.

Introduction 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 information

Javascript. UNIVERSITY OF MASSACHUSETTS AMHERST CMPSCI 120 Fall 2010

Javascript. UNIVERSITY OF MASSACHUSETTS AMHERST CMPSCI 120 Fall 2010 Lecture 14 Javascript Announcements Project #2 New website Exam#2 No. Class Date Subject and Handout(s) 17 11/4/10 Examination Review Practice Exam PDF 18 11/9/10 Search, Safety, Security Slides PDF UMass

More information

Information Science 1

Information 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 information

Programming Languages, Summary CSC419; Odelia Schwartz

Programming Languages, Summary CSC419; Odelia Schwartz Programming Languages, Summary CSC419; Odelia Schwartz Chapter 1 Topics Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation Criteria Influences on Language Design

More information

Visual C# Instructor s Manual Table of Contents

Visual 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 information

A340 Laboratory Session #5

A340 Laboratory Session #5 A340 Laboratory Session #5 LAB GOALS Creating multiplication table using JavaScript Creating Random numbers using the Math object Using your text editor (Notepad++ / TextWrangler) create a web page similar

More information

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications

JavaScript. 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 information

Type Bindings. Static Type Binding

Type Bindings. Static Type Binding Type Bindings Two key issues in binding (or associating) a type to an identifier: How is type binding specified? When does the type binding take place? N. Meng, S. Arthur 1 Static Type Binding An explicit

More information

JewelScript Reference Manual

JewelScript 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 information

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology exam Compiler Construction in4303 April 9, 2010 14.00-15.30 This exam (6 pages) consists of 52 True/False

More information

Chapter 5 Object-Oriented Programming

Chapter 5 Object-Oriented Programming Chapter 5 Object-Oriented Programming Develop code that implements tight encapsulation, loose coupling, and high cohesion Develop code that demonstrates the use of polymorphism Develop code that declares

More information

Subtyping. Lecture 13 CS 565 3/27/06

Subtyping. Lecture 13 CS 565 3/27/06 Subtyping Lecture 13 CS 565 3/27/06 Polymorphism Different varieties of polymorphism: Parametric (ML) type variables are abstract, and used to encode the fact that the same term can be used in many different

More information

Place User-Defined Functions in the HEAD Section

Place User-Defined Functions in the HEAD Section JavaScript Functions Notes (Modified from: w3schools.com) A function is a block of code that will be executed when "someone" calls it. In JavaScript, we can define our own functions, called user-defined

More information

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Introduction: PHP (Hypertext Preprocessor) was invented by Rasmus Lerdorf in 1994. First it was known as Personal Home Page. Later

More information

Siebel escript Language Reference. Siebel Innovation Pack 2016 April 2016

Siebel escript Language Reference. Siebel Innovation Pack 2016 April 2016 Siebel escript Language Reference Siebel Innovation Pack 2016 April 2016 Copyright 2005, 2016 Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under

More information

PL / SQL Basics. Chapter 3

PL / SQL Basics. Chapter 3 PL / SQL Basics Chapter 3 PL / SQL Basics PL / SQL block Lexical units Variable declarations PL / SQL types Expressions and operators PL / SQL control structures PL / SQL style guide 2 PL / SQL Block Basic

More information

Objectives. 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++ 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 information

Chapter 2: Basic Elements of C++

Chapter 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 information

Chapter 7. Expressions and Assignment Statements ISBN

Chapter 7. Expressions and Assignment Statements ISBN Chapter 7 Expressions and Assignment Statements ISBN 0-321-33025-0 Chapter 7 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean Expressions Short-Circuit

More information

Argument Passing All primitive data types (int etc.) are passed by value and all reference types (arrays, strings, objects) are used through refs.

Argument Passing All primitive data types (int etc.) are passed by value and all reference types (arrays, strings, objects) are used through refs. Local Variable Initialization Unlike instance vars, local vars must be initialized before they can be used. Eg. void mymethod() { int foo = 42; int bar; bar = bar + 1; //compile error bar = 99; bar = bar

More information

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction

Chapter 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 information

1.3b Type Conversion

1.3b Type Conversion 1.3b Type Conversion Type Conversion When we write expressions involved data that involves two different data types, such as multiplying an integer and floating point number, we need to perform a type

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Fall 2016 Lecture 7a Andrew Tolmach Portland State University 1994-2016 Values and Types We divide the universe of values according to types A type is a set of values and a

More information

Chapter 7. Expressions and Assignment Statements

Chapter 7. Expressions and Assignment Statements Chapter 7 Expressions and Assignment Statements Chapter 7 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean Expressions Short-Circuit Evaluation Assignment

More information

Java Notes. 10th ICSE. Saravanan Ganesh

Java Notes. 10th ICSE. Saravanan Ganesh Java Notes 10th ICSE Saravanan Ganesh 13 Java Character Set Character set is a set of valid characters that a language can recognise A character represents any letter, digit or any other sign Java uses

More information

Midterm 1. CMSC 430 Introduction to Compilers Spring Instructions Total 100. Name: March 14, 2012

Midterm 1. CMSC 430 Introduction to Compilers Spring Instructions Total 100. Name: March 14, 2012 Name: Midterm 1 CMSC 430 Introduction to Compilers Spring 2012 March 14, 2012 Instructions This exam contains 8 pages, including this one. Make sure you have all the pages. Write your name on the top of

More information

HAWK Language Reference Manual

HAWK Language Reference Manual HAWK Language Reference Manual HTML is All We Know Created By: Graham Gobieski, George Yu, Ethan Benjamin, Justin Chang, Jon Adelson 0. Contents 1 Introduction 2 Lexical Convetions 2.1 Tokens 2.2 Comments

More information