Darshan Institute of Engineering & Technology for Diploma Studies Unit 2. 2 Working with JavaScript

Size: px
Start display at page:

Download "Darshan Institute of Engineering & Technology for Diploma Studies Unit 2. 2 Working with JavaScript"

Transcription

1 2 Working with JavaScript JavaScript concept or What is JavaScript? JavaScript is the programming language of the Web. It is an object-oriented language that allows creation of interactive Web pages. It is most commonly used as part of web browsers, whose implementations allow client-side scripts to interact with the user, control the browser, communicate asynchronously, and alter the document content that is displayed. It is also used in server-side network programming with runtime environments. Javascript is an implementation of the ECMAScript language standard. ECMA-262 is the official Javascript standard. JavaScript is: JavaScript is a lightweight, interpreted programming language Designed for creating network-centric applications Complementary to and integrated with Java Complementary to and integrated with HTML Open and cross-platform It is case sensitive scripting language. Origin of JavaScript JavaScript was released by Netscape and Sun Microsystems in However, JavaScript is not the same thing as Java. JavaScript and Java are completely different languages, both in concept and design. Brendan Eich developed JavaScript for Netscape in the 90s, and it was included with an early version of Netscape 2 in 1995 and became an ECMA standard in During development JavaScript was called Mocha and then LiveScript. Why we use and learn JavaScript? JavaScript is one of the 3 languages all web developers must learn: 1. HTML to define the content of web pages 2. CSS to specify the layout of web pages 3. JavaScript to program the behavior of web pages Advantages of Javascript Speed: Being client-side, JavaScript is very fast because any code functions can be run immediately instead of having to contact the server and wait for an answer. Less server interaction: You can validate user input before sending the page off to the server. This saves server traffic, which means less load on your server. Simplicity: JavaScript is relatively simple to learn and implement. 1 Dept: CE DWSL ( ) Ravi G. Shrimali

2 Versatility: JavaScript plays nicely with other languages and can be used in a huge variety of applications. Unlike PHP or SSI scripts, JavaScript can be inserted into any web page regardless of the file extension. JavaScript can also be used inside scripts written in other languages such as Perl and PHP. Server Load: Being client-side reduces the demand on the website server. Immediate feedback to the visitors: They don't have to wait for a page reload to see if they have forgotten to enter something. Richer interfaces: You can use JavaScript to include such items as drag-and-drop components and sliders to give a Rich Interface to your site visitors. Easy Debugging and Testing: Javascript are tested line by line and the errors and the errors are also listed as they are encountered so it is easy to locate errors, make changes, and test it without the overhead and delay if compiling. JavaScript Syntax A JavaScript consists of JavaScript statements that are placed within the <script>... HTML tags in a web page. You can place the <script> tag containing your JavaScript anywhere within you web page but it is preferred way to keep it within the <head> tags. The <script> tag alert the browser program to begin interpreting all the text between these tags as a script. So simple syntax of your JavaScript will be as follows: Syntax: <script language="javascript" type="text/javascript"> JavaScript code The script tag takes two important attributes: language: This attribute specifies what scripting language you are using. Generally, its value will be javascript. type: This attribute is what is now recommended to indicate the scripting language in use and its value should be set to "text/javascript". <html> <head> <title>javascript Program</title> <script language="javascript" type="text/javascript"> document.write("hello World!"); </head> </html> 2 Dept: CE DWSL ( ) Ravi G. Shrimali

3 Hello World! Javascript Variables JavaScript variables are containers for storing data values. You can place data into these containers and then refer to the data simply by naming the container. Before you use a variable in a JavaScript program, you must declare it. Variables are declared with the var keyword as follows: var money; var name; Use the var keyword only for declaration or initialization. You should not re-declare same variable twice. JavaScript is untyped language. This means that a JavaScript variable can hold a value of any data type. Unlike many other languages, you don't have to tell JavaScript during variable declaration what type of value the variable will hold. JavaScript Variable Scope The scope of a variable is the region of your program in which it is defined. JavaScript variable will have only two scopes. Global Variables: It has global scope which means it is defined everywhere in your JavaScript code. Local Variables: It will be visible only within a function where it is defined. Function parameters are always local to that function. Within the body of a function, a local variable takes precedence over a global variable with the same name. If you declare a local variable or function parameter with the same name as a global variable, you effectively hide the global variable. Following example explains it: <html> <head> <title>javascript Program</title> var demo = "global"; // Declare a global variable function checkscope( ) var demo = "local"; // Declare a local variable </head> <body> document.write(demo); 3 Dept: CE DWSL ( ) Ravi G. Shrimali

4 <button onclick="checkscope();">click Me</button> </body> </html> The Above example will produces the following result as an output: local JavaScript Identifiers All JavaScript variables must be identified with unique names. These unique names are called identifiers. JavaScript identifiers are case-sensitive. The general rules for constructing names for variables (unique identifiers) are: Names can contain letters, digits, underscores, and dollar signs Names must begin with a letter Names can also begin with $ and _ Names are case sensitive (a and A are different variables) Reserved words (like JavaScript keywords) cannot be used as names JavaScript Reserved Words The following are reserved words in JavaScript. They cannot be used as JavaScript variables, functions, methods, loop labels, or any object names. Javascript Data Types The DataType is a classification of the type of data that a variable or object can hold in computer programming. JavaScript allows you to work with three primitive data types: Numbers, Strings and Boolean. Numbers: Numbers in JavaScript are represented in 64-bit floating-point format. JavaScript makes no distinction between integers and floating-point numbers. For example: e23 4 Dept: CE DWSL ( ) Ravi G. Shrimali

5 Strings: String literals appear in JavaScript programs between single or double quotes. One style of quotes may be nested within the other. For example, 'name ="MyData" '. 'testing' "3. 14" "Wouldn't you prefer O'Reilly's book?" Boolean: the Boolean type has two possible values, represented by the JavaScript keywords true and false. JavaScript also defines two trivial data types: null and undefined, each of which defines only a single value. null: The JavaScript keyword null is a special value that indicates "no value". undefined: In JavaScript, a variable without a value, has the value undefined. The typeof is also undefined. In addition to these primitive data types, JavaScript supports a composite data type known as Object and Array. Object: JavaScript objects are written with curly braces. Object properties are written as name:value pairs, separated by commas. The object (person) in the example above has 3 properties: firstname, lastname and age. var person = firstname:"peter", lastname:"pan", age:25; Array: JavaScript arrays are written with square brackets. Array items are separated by commas. The following code declares (creates) an array called cars, containing three items (car names): var cars = ["Audi", "Skoda", "Maruti"]; Javascript Operators An operator is a symbol that is used to perform specific mathematical or logical operations. JavaScript language supports following type of operators. Arithmetic Operators Comparison Operators Logical Operators Bitwise Operators Assignment Operators Conditional (or ternary) Operators String Operators typeof Operators Arithmetic Operators Arithmetic operators are used to perform arithmetic between variables and/or values. There are following arithmetic operators supported by JavaScript language. Assume variable A holds 10 and variable B holds 20 then: 5 Dept: CE DWSL ( ) Ravi G. Shrimali

6 Assignment Operators Assignment operators are used to assign values to JavaScript variables. There are following assignment operators supported by JavaScript language: Conditional Operator JavaScript also contains a conditional operator that assigns a value to a variable based on some condition. This operator first evaluates an expression for a true or false value and then execute one of the two given statements depending upon the result of the evaluation. The conditional operator has this syntax: 6 Dept: CE DWSL ( ) Ravi G. Shrimali

7 Comparison Operators Comparison operators are used in logical statements to determine equality or difference between variables or values. There are following comparison operators supported by JavaScript language. Assume variable A holds 10 and variable B holds 20 then: Logical Operators Logical operators are used to determine the logic between variables or values. There are following logical operators supported by JavaScript language. Assume variable A holds 10 and variable B holds 20 then: Bitwise Operators The Bit operators work on 32 bits numbers. Any numeric operand in the operation is converted into a 32 bit number. The result is converted back to a JavaScript number. There are following bitwise operators supported by JavaScript language. Assume variable A holds 2 and variable B holds 3 then: 7 Dept: CE DWSL ( ) Ravi G. Shrimali

8 String Operators The + operator can also be used to concatenate (add) strings. To add two or more string variables together, use the + operator which is shown in below example. Data1 = "What a very "; Data2 = "nice day"; Ans = txt1 + txt2; The output of Ans will be: What a very nice day Adding two numbers, will return the sum, but adding a number and a string will return a string: y = "5" + 5; z= "Hello" + 5; The result of x, y, and z will be: 55 Hello5 8 Dept: CE DWSL ( ) Ravi G. Shrimali

9 The typeof Operator The typeof is a unary operator that is placed before its single operand, which can be of any type. Its value is a string indicating the data type of the operand. The typeof operator evaluates to "number", "string", or "boolean" if its operand is a number, string, or boolean value and returns true or false based on the evaluation. Here is the list of return values for the typeof Operator : Javascript Literals Literals are the way you represent values in JavaScript. In other word, we can say that these are fixed values that you literally provide in your application source, and are not variables. The below section describe the following types of literals. Integers Literals Integers can be expressed in decimal (base 10), hexadecimal (base 16), or octal (base 8) format. A decimal integer literal consists of a sequence of digits without a leading 0 (zero). Some examples of integers literals are: 123, -20, // Decimal (base 10) 7b, -14, 3039 // Hexadecimal (base 16) 173, -24, // Octal (base 8) Floating Point Literals A floating point literal can have the following parts: a decimal integer, a decimal point ("."), a fraction, an exponent, and a type suffix. A floating point literal must have at least one digit, plus either a decimal point or "e" (or "E"). Some examples of floating point literals are: E12.1e12 2E-12 9 Dept: CE DWSL ( ) Ravi G. Shrimali

10 Boolean Literals The Boolean type has two literal values: true and false. Object literals An object literal is zero or more pairs of comma separated list of property names and associated values, enclosed by a pair of curly braces. In JavaScript an object literal is declared as follows: 1. An object literal without properties: var userobject= 2. An object literal with a few properties: var student= FirstName:"Peter", LastName:"Parker", Age:24 ; String Literals A string literal is zero or more characters enclosed in double (") or single (') quotes. A string must be delimited by quotes of the same type. The following are examples of string literals: "Hello! How are you?" 'Good Morning' "1234" "I am Peter \n My Hobby is Cricket" Special Characters You can use the following special characters in JavaScript string literals: \b indicates a backspace. \f indicates a form feed. \n indicates a new line character. \r indicates a carriage return. \t indicates a tab character. Escaping Characters You can insert quotes inside of strings by preceding them by a backslash. This is known as escaping the quotes. The following is the example of escaping character literals: var Message="He read \"the book of javascript\" by Peter James."; document.write(message); The result of this would be He read "the book of javascript" by Peter James. 10 Dept: CE DWSL ( ) Ravi G. Shrimali

11 JavaScript Array Array is used to store multiple values in a single variable. An array can hold many values under a single name, and you can access the values by referring to an index number. Arrays are a special type of objects. The typeof operator in JavaScript returns "object" for arrays. The main difference between array and object are that arrays use numbered indexes whereas objects use named indexes. Creating an Array Syntax: var array-name = [item1, item2,...]; OR var array-name = new Array(item1, item2,...); //Creating an Array object The Array parameter is a list of strings or integers. When you specify a single numeric parameter with the Array constructor, you specify the initial length of the array. The maximum length allowed for an array is 4,294,967,295. var Games = [ "Chess", "Cricket", "Football" ]; //create an array by simply assigning values You can access an array element by referring its index number. Games[0] is the first element (Chess) Games[1] is the second element (Cricket) Games[2] is the third element (Football) Creating a multi-level (multidimensional) structure. var matrix = [[1, 2, 3],[4, 5, 6],[7, 8, 9]]; To access the value from multi-level structure. matrix[1][1]); //it will gives a value "5" Array Properties: Here is a list of each property and their description. Property constructor index length prototype Description Returns a reference to the array function that created the object. The property represents the zero-based index of the match in the string Sets or returns the number of elements in an array Allows you to add properties and methods to an Array object Array Methods Here is a list of each method and its description. Method Description Syntax concat() Joins two or more arrays, and returns a copy of the joined array.concat(value1, arrays. value2,..., valuen); 11 Dept: CE DWSL ( ) Ravi G. Shrimali

12 indexof() Search the array for an element and returns its position. array.indexof(searchele ment[, fromindex]); join() Joins all elements of an array into a string. array.join(separator); lastindexof() Search the array for an element, starting at the end, and returns its position. array.lastindexof(search Element[, fromindex]); pop() Removes the last element of an array, and returns that array.pop(); element. push() Adds new elements to the end of an array, and returns the new length. array.push(element1,..., elementn); reverse() Reverses the order of the elements in an array. array.reverse(); shift() Removes the first element of an array, and returns that element. array.shift(); slice() Selects a part of an array, and returns the new array. array.slice( begin [,end] ); sort() Sorts the elements of an array. array.sort( comparefunction ); splice() Adds/Removes elements from an array. array.splice(index, howmany, [element1][,..., elementn]); tostring() Converts an array to a string, and returns the result. array.tostring(); unshift() valueof() Adds new elements to the beginning of an array, and returns the new length. Returns the primitive value of an array. It returns an array as a string. array.unshift( element1,..., elementn ); array.valueof(); <html> <head> <title>the Array Method Example</title> var Games=["Cricket", "Chess", "Football", "TableTennis","WWE"]; document.write("<b>pop Method </b>" + Games.pop() + "</br>"); // Removes the last element ("WWE") from Games document.write("<b>final Result after using Pop method: </b>" + Games +"</br></br>"); document.write("<b>push Method </b>" + Games.push("WWE") + "</br>"); // Adds a new element("wwe") to Games document.write("<b>final Result after using Push method: </b>" + Games + "</br></br>"); document.write("<b>shift Method </b>" + Games.shift() + "</br>"); // Removes the first element "Cricket" from Games 12 Dept: CE DWSL ( ) Ravi G. Shrimali

13 document.write("<b>final Result after using Shift method: </b>" + Games + "</br></br>"); document.write("<b>unshift Method </b>" + Games.unshift("KhoKho") + "</br>"); // Adds a new element "KhoKho" to Games document.write("<b>final Result after using Unshift method: </b>" + Games + "</br></br>"); </head> <body> </body> </html> Pop Method WWE Final Result after using Pop method: Cricket,Chess,Football,TableTennis Push Method 5 Final Result after using Push method: Cricket,Chess,Football,TableTennis,WWE Shift Method Cricket Final Result after using Shift method: Chess,Football,TableTennis,WWE Unshift Method 5 Final Result after using Unshift method: KhoKho,Chess,Football,TableTennis,WWE Javascript Functions A JavaScript function is a block of code designed to perform a particular task. This eliminates the need of writing same code again and again. This will help programmers to write modular code. You can divide your big Programme in a number of small and manageable functions. Like any other advance programming language, JavaScript also supports all the features necessary to write modular code using functions. Function Definition: Before we use a function we need to define that function. The most common way to define a function in JavaScript is by using the function keyword, followed by a unique function name, a list of parameters (that might be empty), and a statement block surrounded by curly braces. The basic syntax is shown here: 13 Dept: CE DWSL ( ) Ravi G. Shrimali

14 Syntax: function functionname(parameter-list) Block of code or statements function PrintMessage() alert("hello! How are you?"); Calling a Function: To invoke a function somewhere later in the script, you would simple need to write the name of that function as follows: PrintMessage(); Function Parameters: In Function, you can pass different parameters while calling a function. These passed parameters can be captured inside the function and any manipulation can be done over those parameters. A function can take multiple parameters separated by comma. function MyIntro(Name, Hobby) alert("my Name is " + Name + ". My Hobby is " + Hobby); Now we can call this function as follows: MyIntro('Peter Parker', 'Cricket' ); The return Statement: A JavaScript function can have an optional return statement. This is required if you want to return a value from a function. This statement should be the last statement in a function. For example, if you want to pass two numbers in a function and then you can expect from the function to return their multiplication in your calling program which is described below: 14 Dept: CE DWSL ( ) Ravi G. Shrimali

15 function Multiplication(Number1, Number2) var Total; Total=Number1*Number2; return Total; Now we can call this function as follows. It will display a popup box showing a result the multiplication of two numbers. var result; result=multiplication(25, 25); alert(result); JavaScript Control Statements The Control Structures within JavaScript allow the program flow to change within a unit of code or function. These statements can determine whether or not given statements are executed, as well as repeated execution of a block of code. Javascript supports conditional statements are used to perform different actions based on different conditions. In JavaScript we have the following conditional statements: if to specify a block of code to be executed, if a specified condition is true. If else to specify a block of code to be executed, if the same condition is false. If else if to specify a new condition to test, if the first condition is false. switch to specify many alternative blocks of code to be executed. The if Statement This statement is used to specify a block of JavaScript code to be executed if a condition is true. Syntax: if (condition or expression) Block of code to be executed if the condition is true The Following below example display a message if the age is greater than Dept: CE DWSL ( ) Ravi G. Shrimali

16 var age=20; if (age>18) document.write("great you are eligible to apply for driving license"); Great you are eligible to apply for driving license The if else Statement This statement is used to specify a block of code to be executed if the condition is false. Syntax: if (condition or expression) Block of code to be executed if the condition is true else Block of code to be executed if the condition is false The Following below example display a message if the age is greater than 18 otherwise it will display a message that is written in the else portion. var age=15; if (age < 18) document.write("great you are eligible to apply for driving license"); else document.write("sorry you are not eligible to apply for driving license"); Sorry you are not eligible to apply for driving license The if else if Statement This statement is used to specify a new condition if the first condition is false. 16 Dept: CE DWSL ( ) Ravi G. Shrimali

17 Syntax: if (condition1 or expression1) Block of code to be executed if condition1 is true else if (condition2 or expression2) Block of code to be executed if the condition1 is false and condition2 is true else Block of code to be executed if the condition1 is false and condition2 is false var book="history"; if(book=="history") document.write("<b>you Select History Book</b>"); else if(book=="maths") document.write("<b>you Select Maths Book</b>"); else if(book=="economics") document.write("<b>you Select Economics Book</b>"); else document.write("<b>you Select nothing</b>"); You Select History Book The Switch Statement This statement is used to select one of many blocks of code to be executed. The switch expression is evaluated once. The value of the expression is compared with the values of each case. If there is a match, the associated block of code is executed. 17 Dept: CE DWSL ( ) Ravi G. Shrimali

18 When the JavaScript code interpreter reaches a break keyword, it breaks out of the switch block. This will stop the execution of more execution of code and/or case testing inside the block. Syntax: switch(expression) case condition 1: statement(s) break; case condition 2: statement(s) break;... case condition n: statement(s) break; default: statement(s) var grade=2; document.write("you got "); switch (grade) case 1: document.write("distinction.<br />"); break; case 2: document.write("first Class.<br />"); break; case 3: document.write("second Class.<br />"); break; case 4: document.write("pass Class.<br />"); break; default: document.write("fail.<br />"); You got First Class. Looping Structure While writing a program, there may be a situation when you need to perform some action over and over again. In such situation you would need to write loop statements to reduce the number of lines. JavaScript supports all the necessary loops: for, for...in, while and do...while. 18 Dept: CE DWSL ( ) Ravi G. Shrimali

19 The for Loop The for loop is the most compact form of looping and includes the following three important parts: The loop initialization where we initialize our counter to a starting value. The initialization statement is executed before the loop begins. The test statement which will test if the given condition is true or not. If condition is true then code given inside the loop will be executed otherwise loop will come out. The iteration statement where you can increase or decrease your counter. You can put all the three parts in a single line separated by a semicolon. Syntax: for(initialization; test condition; iteration statement) Block of code to be executed if test condition is true var count; document.write("print the numbers from 1 to 5" + "<br />"); for(count=1; count<=5; count++) document.write("current Count: " + count ); document.write("<br />"); document.write("finally Print!"); Print the numbers from 1 to 5 Current Count: 1 Current Count: 2 Current Count: 3 Current Count: 4 Current Count: 5 Finally Print! The while Loop The main purpose of using a while loop is to execute a statement or code block repeatedly as long as expression is true. Once expression becomes false, the loop will be exited. Syntax: while(expression) Block of code to be executed 19 Dept: CE DWSL ( ) Ravi G. Shrimali

20 var count=1; document.write("print the numbers from 1 to 4" + "<br />"); while(count<5) document.write("current Count: " + count); document.write("<br />"); count++; document.write("finally Print!"); Print the numbers from 1 to 4 Current Count: 1 Current Count: 2 Current Count: 3 Current Count: 4 Finally Print! The do...while Loop The do...while loop is works similar like to the while loop except that the condition check happens at the end of the loop. This means that the loop will always be executed at least once, even if the condition is false. Syntax: do Block of code to be executed; while(expression); var count=1; document.write("starting Loop" + "<br />"); do document.write("current Count: " + count + "<br />"); count++; while(count < 2); document.write("loop stopped!"); 20 Dept: CE DWSL ( ) Ravi G. Shrimali

21 Starting Loop Current Count: 1 Loop stopped! The for...in Loop There is one more loop supported by JavaScript. It is called for...in loop. This loop is used to loop through an object's properties. In each iteration one property from object is assigned to variablename and this loop continues till all the properties of the object are exhausted. Syntax: for (variablename in object) Statement or block to execute var message=""; var person=firstname:"peter", LastName:"Parker", Age:20; var addvalue; document.write("<b>information of an Employee:</b><br/> "); for(addvalue in person) document.write(person[addvalue]); document.write("<br />"); document.write("thanks for the Details!"); Information of an Employee: Peter Parker 20 Thanks for the Details! JavaScript Loop Control JavaScript provides you full control to handle your loops and switch statement. There may be a situation when you need to come out of a loop without reaching at its bottom. There may also be a situation when you want to skip a part of your code block and want to start next iteration of the look. 21 Dept: CE DWSL ( ) Ravi G. Shrimali

22 To handle all such situations, JavaScript provides break and continue statements. These statements are used to immediately come out of any loop or to start the next iteration of any loop respectively. The break Statement The break statement is used to jump out of a loop. The break statement will stop the execution of code and/or case testing inside switch statement and continues executing the code after the loop. <html> <head> <title>the Break Statement</title> function breakloop() var count = 0; document.write("entering the loop<br/>"); while(count < 20) if (count==5) break; // breaks out of loop completely count=count+1; document.write(count + "<br />"); document.write("exiting the loop!<br/>"); </head> <body> <p>click the button to see the result using Break Statement.</p> <button onclick="breakloop();">try it</button> </body> </html> The above code will produce the below result when button is pressed. Entering the loop Dept: CE DWSL ( ) Ravi G. Shrimali

23 4 5 Exiting the loop! The Continue Statement The continue statement tells the interpreter to immediately start the next iteration of the loop and skip remaining code block. When a continue statement is encountered, program flow will move to the loop check expression immediately and if condition remain true then it start next iteration otherwise control comes out of the loop. <html> <head> <title>the Continue Statement</title> function continueloop() var count = 0; document.write("entering the loop<br/>"); while(count < 10) count=count+1; if (count==5) continue; // skill rest of the loop body document.write(count + "<br />"); document.write("exiting the loop!<br/>"); </head> <body> <p>click the button to see the result using Continue Statement.</p> <button onclick="continueloop();">try it</button> </body> </html> The above code will produce the below result when button is pressed. 23 Dept: CE DWSL ( ) Ravi G. Shrimali

24 Entering the loop Exiting the loop! Using Labels to Control the Flow A label is simply an identifier followed by a colon that is applied to a statement or block of code. We will see two different examples to understand label with break and continue. A label can be used with break and continue to control the flow more precisely. <html> <head> <title>using Labels to Control the Flow</title> function Labeldemo() document.write("entering the loop!<br /> "); outerloop: // This is the label name for(var i=0;i<3; i++) document.write("outerloop: " + i + "<br />"); innerloop: for(var j=0;j<5;j++) if(j > 2) break innerloop; // Quit the innermost loop document.write("innerloop: " + j + " <br />"); 24 Dept: CE DWSL ( ) Ravi G. Shrimali

25 document.write("exiting the loop!<br /> "); </head> <body> <p>click the button to see the result using Labels.</p> <button onclick="labeldemo();">try it</button> </body> </html> The above code will produce the below result when button is pressed. Entering the loop! Outerloop: 0 Innerloop: 0 Innerloop: 1 Innerloop: 2 Outerloop: 1 Innerloop: 0 Innerloop: 1 Innerloop: 2 Outerloop: 2 Innerloop: 0 Innerloop: 1 Innerloop: 2 Exiting the loop! 25 Dept: CE DWSL ( ) Ravi G. Shrimali

CGS 3066: Spring 2015 JavaScript Reference

CGS 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 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

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

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

Object oriented programming. Instructor: Masoud Asghari Web page: Ch: 3

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

Princess Nourah bint Abdulrahman University. Computer Sciences Department

Princess 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 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

The JavaScript Language

The 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 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

Working with JavaScript

Working with JavaScript Working with JavaScript Creating a Programmable Web Page for North Pole Novelties 1 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page 2 Objectives

More information

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual

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

JavaScript I Language Basics

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

Chapter 2 Working with Data Types and Operators

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

What is PHP? [1] Figure 1 [1]

What is PHP? [1] Figure 1 [1] PHP What is PHP? [1] PHP is an acronym for "PHP: Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed on the server PHP is free to download and use Figure

More information

JME Language Reference Manual

JME 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 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 1 Professional Program: Data Administration and Management JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) WHO

More information

INFS 2150 Introduction to Web Development and e-commerce Technology. Programming with JavaScript

INFS 2150 Introduction to Web Development and e-commerce Technology. Programming with JavaScript INFS 2150 Introduction to Web Development and e-commerce Technology Programming with JavaScript 1 Objectives JavaScript client-side programming Example of a JavaScript program The element

More information

Objectives. Introduction to JavaScript. Introduction to JavaScript INFS Peter Y. Wu, RMU 1

Objectives. Introduction to JavaScript. Introduction to JavaScript INFS Peter Y. Wu, RMU 1 Objectives INFS 2150 Introduction to Web Development and e-commerce Technology Programming with JavaScript JavaScript client-side programming Example of a JavaScript program The element

More information

JAVASCRIPT. sarojpandey.com.np/iroz. JavaScript

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

Java+- Language Reference Manual

Java+- Language Reference Manual Fall 2016 COMS4115 Programming Languages & Translators Java+- Language Reference Manual Authors Ashley Daguanno (ad3079) - Manager Anna Wen (aw2802) - Tester Tin Nilar Hlaing (th2520) - Systems Architect

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

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

COMP519 Web Programming Lecture 11: JavaScript (Part 2) Handouts

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

Chapter 3 Data Types and Variables

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

UNIT- 3 Introduction to C++

UNIT- 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 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

Let's Look Back. We talked about how to create a form in HTML. Forms are one way to interact with users

Let's Look Back. We talked about how to create a form in HTML. Forms are one way to interact with users Introduction to PHP Let's Look Back We talked about how to create a form in HTML Forms are one way to interact with users Users can enter information into forms which can be used by you (programmer) We

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

COMP284 Scripting Languages Lecture 15: JavaScript (Part 2) Handouts

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

Chapter 17. Fundamental Concepts Expressed in JavaScript

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

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

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

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

Overview: Programming Concepts. Programming Concepts. Names, Values, And Variables

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

Overview: Programming Concepts. Programming Concepts. Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript

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

<form>. input elements. </form>

<form>. input elements. </form> CS 183 4/8/2010 A form is an area that can contain form elements. Form elements are elements that allow the user to enter information (like text fields, text area fields, drop-down menus, radio buttons,

More information

UNIT -II. Language-History and Versions Introduction JavaScript in Perspective-

UNIT -II. Language-History and Versions Introduction JavaScript in Perspective- UNIT -II Style Sheets: CSS-Introduction to Cascading Style Sheets-Features- Core Syntax-Style Sheets and HTML Style Rle Cascading and Inheritance-Text Properties-Box Model Normal Flow Box Layout- Beyond

More information

This tutorial will help you understand JSON and its use within various programming languages such as PHP, PERL, Python, Ruby, Java, etc.

This tutorial will help you understand JSON and its use within various programming languages such as PHP, PERL, Python, Ruby, Java, etc. About the Tutorial JSON or JavaScript Object Notation is a lightweight text-based open standard designed for human-readable data interchange. The JSON format was originally specified by Douglas Crockford,

More information

Language Fundamentals Summary

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

Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:

Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators

More information

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

JavaScript Functions, Objects and Array

JavaScript Functions, Objects and Array JavaScript Functions, Objects and Array Defining a Function A definition starts with the word function. A name follows that must start with a letter or underscore, followed by any number of letters, digits,

More information

TED Language Reference Manual

TED Language Reference Manual 1 TED Language Reference Manual Theodore Ahlfeld(twa2108), Konstantin Itskov(koi2104) Matthew Haigh(mlh2196), Gideon Mendels(gm2597) Preface 1. Lexical Elements 1.1 Identifiers 1.2 Keywords 1.3 Constants

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

What is Java Script? Writing to The HTML Document. What Can JavaScript do? CMPT 165: Java Script

What is Java Script? Writing to The HTML Document. What Can JavaScript do? CMPT 165: Java Script What is Java Script? CMPT 165: Java Script Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University November 7, 2011 JavaScript was designed to add interactivity to HTML pages

More information

Syllabus - July to Sept

Syllabus - July to Sept Class IX Sub: Computer Syllabus - July to Sept What is www: The World Wide Web (www, W3) is an information space where documents and other web resources are identified by URIs, interlinked by hypertext

More information

PHP and MySQL for Dynamic Web Sites. Intro Ed Crowley

PHP and MySQL for Dynamic Web Sites. Intro Ed Crowley PHP and MySQL for Dynamic Web Sites Intro Ed Crowley Class Preparation If you haven t already, download the sample scripts from: http://www.larryullman.com/books/phpand-mysql-for-dynamic-web-sitesvisual-quickpro-guide-4thedition/#downloads

More information

Introduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p.

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

egrapher Language Reference Manual

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

GridLang: Grid Based Game Development Language Language Reference Manual. Programming Language and Translators - Spring 2017 Prof.

GridLang: Grid Based Game Development Language Language Reference Manual. Programming Language and Translators - Spring 2017 Prof. GridLang: Grid Based Game Development Language Language Reference Manual Programming Language and Translators - Spring 2017 Prof. Stephen Edwards Akshay Nagpal Dhruv Shekhawat Parth Panchmatia Sagar Damani

More information

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University Unit 1 Programming Language and Overview of C 1. State whether the following statements are true or false. a. Every line in a C program should end with a semicolon. b. In C language lowercase letters are

More information

Program Design Phase. Algorithm Design - Mathematical. Algorithm Design - Sequence. Verify Algorithm Y = MX + B

Program Design Phase. Algorithm Design - Mathematical. Algorithm Design - Sequence. Verify Algorithm Y = MX + B Program Design Phase Write Program Specifications Analysis of requirements Program specifications description Describe what the goals of the program Describe appearance of input and output Algorithm Design

More information

do fifty two: Language Reference Manual

do fifty two: Language Reference Manual do fifty two: Language Reference Manual Sinclair Target Jayson Ng Josephine Tirtanata Yichi Liu Yunfei Wang 1. Introduction We propose a card game language targeted not at proficient programmers but at

More information

SEEM4570 System Design and Implementation Lecture 03 JavaScript

SEEM4570 System Design and Implementation Lecture 03 JavaScript SEEM4570 System Design and Implementation Lecture 03 JavaScript JavaScript (JS)! Developed by Netscape! A cross platform script language! Mainly used in web environment! Run programs on browsers (HTML

More 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

People = End Users & Programmers. The Web Browser Application. Program Design Phase. Algorithm Design -Mathematical Y = MX + B

People = End Users & Programmers. The Web Browser Application. Program Design Phase. Algorithm Design -Mathematical Y = MX + B The Web Browser Application People = End Users & Programmers Clients and Components Input from mouse and keyboard Controller HTTP Client FTP Client TCP/IP Network Interface HTML/XHTML CSS JavaScript Flash

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

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

JavaScript Basics. The Big Picture

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

CITS1231 Web Technologies. JavaScript

CITS1231 Web Technologies. JavaScript CITS1231 Web Technologies JavaScript Contents Introduction to JavaScript Variables Operators Conditional Statements Program Loops Popup Boxes Functions 2 User Interaction User interaction requires web

More information

PHP. Interactive Web Systems

PHP. Interactive Web Systems PHP Interactive Web Systems PHP PHP is an open-source server side scripting language. PHP stands for PHP: Hypertext Preprocessor One of the most popular server side languages Second most popular on GitHub

More information

Full file at

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

UNIT IV 2 MARKS. ( Word to PDF Converter - Unregistered ) FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING

UNIT IV 2 MARKS. ( Word to PDF Converter - Unregistered )   FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING ( Word to PDF Converter - Unregistered ) http://www.word-to-pdf-converter.net FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING INTRODUCTION TO C UNIT IV Overview of C Constants, Variables and Data Types

More information

CHAPTER 6 JAVASCRIPT PART 1

CHAPTER 6 JAVASCRIPT PART 1 CHAPTER 6 JAVASCRIPT PART 1 1 OVERVIEW OF JAVASCRIPT JavaScript is an implementation of the ECMAScript language standard and is typically used to enable programmatic access to computational objects within

More information

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been

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

\n is used in a string to indicate the newline character. An expression produces data. The simplest expression

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

Lecture 14. Introduction to JavaScript. Mr. Mubashir Ali Lecturer (Dept. of Computer Science)

Lecture 14. Introduction to JavaScript. Mr. Mubashir Ali Lecturer (Dept. of Computer Science) Lecture 14 Introduction to JavaScript Mr. Mubashir Ali Lecturer (Dept. of dr.mubashirali1@gmail.com 1 Outline What is JavaScript? Embedding JavaScript with HTML JavaScript conventions Variables in JavaScript

More information

4 Programming Fundamentals. Introduction to Programming 1 1

4 Programming Fundamentals. Introduction to Programming 1 1 4 Programming Fundamentals Introduction to Programming 1 1 Objectives At the end of the lesson, the student should be able to: Identify the basic parts of a Java program Differentiate among Java literals,

More information

C OVERVIEW BASIC C PROGRAM STRUCTURE. C Overview. Basic C Program Structure

C OVERVIEW BASIC C PROGRAM STRUCTURE. C Overview. Basic C Program Structure C Overview Basic C Program Structure C OVERVIEW BASIC C PROGRAM STRUCTURE Goals The function main( )is found in every C program and is where every C program begins speed execution portability C uses braces

More information

Lexical Considerations

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

Lecture 3: The Basics of JavaScript. Background. Needs for Programming Capability. Origin of JavaScript. Using Client-side JavaScript

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

Index COPYRIGHTED MATERIAL

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

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language 1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC

More information

710 Index Attributes, 127 action attribute, 263 assigning, bottom attribute, domain name attribute, 481 expiration date attribute, 480 8

710 Index Attributes, 127 action attribute, 263 assigning, bottom attribute, domain name attribute, 481 expiration date attribute, 480 8 INDEX Symbols = (assignment operator), 56 \ (backslash), 33 \b (backspace), 33 \" (double quotation mark), 32 \e (escape), 33 \f (form feed), 33

More information

CISC 1600 Lecture 2.4 Introduction to JavaScript

CISC 1600 Lecture 2.4 Introduction to JavaScript CISC 1600 Lecture 2.4 Introduction to JavaScript Topics: Javascript overview The DOM Variables and objects Selection and Repetition Functions A simple animation What is JavaScript? JavaScript is not Java

More information

JavaScript. The Bad Parts. Patrick Behr

JavaScript. The Bad Parts. Patrick Behr JavaScript The Bad Parts Patrick Behr History Created in 1995 by Netscape Originally called Mocha, then LiveScript, then JavaScript It s not related to Java ECMAScript is the official name Many implementations

More information

C OVERVIEW. C Overview. Goals speed portability allow access to features of the architecture speed

C OVERVIEW. C Overview. Goals speed portability allow access to features of the architecture speed C Overview C OVERVIEW Goals speed portability allow access to features of the architecture speed C fast executables allows high-level structure without losing access to machine features many popular languages

More information

a Why JavaScript? jonkv interactivity on the web CGI JavaScript Java Applets Netscape LiveScript JavaScript 1: Example

a Why JavaScript? jonkv interactivity on the web CGI JavaScript Java Applets Netscape LiveScript JavaScript 1: Example Why JavaScript? 2 JavaScript JavaScript the language Web page manipulation with JavaScript and the DOM 1994 1995: Wanted interactivity on the web Server side interactivity: CGI Common Gateway Interface

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

COSC 122 Computer Fluency. Programming Basics. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 122 Computer Fluency. Programming Basics. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 122 Computer Fluency Programming Basics Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) We will learn JavaScript to write instructions for the computer.

More information

JScript Reference. Contents

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

The JavaScript Language

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

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

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

Java 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, 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 information

Lesson 1: Writing Your First JavaScript

Lesson 1: Writing Your First JavaScript JavaScript 101 1-1 Lesson 1: Writing Your First JavaScript OBJECTIVES: In this lesson you will be taught how to Use the tag Insert JavaScript code in a Web page Hide your JavaScript

More information

MatchaScript: Language Reference Manual Programming Languages & Translators Spring 2017

MatchaScript: 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

Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 11 Introduction to PHP

Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 11 Introduction to PHP Chapter 11 Introduction to PHP 11.1 Origin and Uses of PHP Developed by Rasmus Lerdorf in 1994 PHP is a server-side scripting language, embedded in XHTML pages PHP has good support for form processing

More information

Language Reference Manual

Language Reference Manual ALACS Language Reference Manual Manager: Gabriel Lopez (gal2129) Language Guru: Gabriel Kramer-Garcia (glk2110) System Architect: Candace Johnson (crj2121) Tester: Terence Jacobs (tj2316) Table of Contents

More information

EDIABAS BEST/2 LANGUAGE DESCRIPTION. VERSION 6b. Electronic Diagnostic Basic System EDIABAS - BEST/2 LANGUAGE DESCRIPTION

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

Data and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence

Data and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence Data and Variables Data Types Expressions Operators Precedence String Concatenation Variables Declaration Assignment Shorthand operators Review class All code in a java file is written in a class public

More information

COMS W4115 Programming Languages & Translators GIRAPHE. Language Reference Manual

COMS W4115 Programming Languages & Translators GIRAPHE. Language Reference Manual COMS W4115 Programming Languages & Translators GIRAPHE Language Reference Manual Name UNI Dianya Jiang dj2459 Vince Pallone vgp2105 Minh Truong mt3077 Tongyun Wu tw2568 Yoki Yuan yy2738 1 Lexical Elements

More information

Sprite an animation manipulation language Language Reference Manual

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

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Parts of a C++ Program Parts of a C++ Program // sample C++ program

More information

Decaf Language Reference Manual

Decaf Language Reference Manual Decaf Language Reference Manual C. R. Ramakrishnan Department of Computer Science SUNY at Stony Brook Stony Brook, NY 11794-4400 cram@cs.stonybrook.edu February 12, 2012 Decaf is a small object oriented

More information

Introduction to Web Tech and Programming

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

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information