Скачать презентацию Java Script Jonathan Vinson CSC 415 History Скачать презентацию Java Script Jonathan Vinson CSC 415 History

53a5e335dbae0f00788b83af7568f9f1.ppt

  • Количество слайдов: 21

Java. Script Jonathan Vinson CSC 415 Java. Script Jonathan Vinson CSC 415

History Developed in 1995 by Brendan Eich (Netscape) Created in 10 days Originally called History Developed in 1995 by Brendan Eich (Netscape) Created in 10 days Originally called Mocha, then Live. Script Trademarked by Sun and became Java. Script Officially called ECMAScript since it was standardized by EMCA in 1996 Now on ECMAScript 5

Names Must begin with a letter, $, or _ Can contain letters, digits, underscores, Names Must begin with a letter, $, or _ Can contain letters, digits, underscores, and dollar signs Case sensitive Reserved words cannot be used as names

Scope Static scoped Variables declared within a Java. Script function are local to that Scope Static scoped Variables declared within a Java. Script function are local to that function Variables declared outside of a function have global scope Assigning a value to a variable that hasn't yet been declared will automatically make that variable global

Data Types Dynamic Data Types Number String Boolean Array Object Undefined Empty Data Types Dynamic Data Types Number String Boolean Array Object Undefined Empty

Operators +, -, *, /, %, ++, -- ==, ===, !==, >, <, >=, Operators +, -, *, /, %, ++, -- ==, ===, !==, >, <, >=, <= &&, ||, ! &, |, ~, ^, <<, >> typeof, delete, unary + Strings can use arithmetic operators to interact with other strings and numbers Unary + operator converts a string to an integer

Statements =, +=, -=, *=, /=, %= While Do … while For … in Statements =, +=, -=, *=, /=, %= While Do … while For … in If … else Control: continue, break

Subprograms Functions are used in Java. Script function my. Function(p 1, p 2) { Subprograms Functions are used in Java. Script function my. Function(p 1, p 2) { return p 1 * p 2; }

Exception Handling Try, Catch, Throw, and Finally try { if(x == Exception Handling Try, Catch, Throw, and Finally try { if(x == "") throw "Empty"; if(is. Na. N(x)) throw "Not a number"; if(x > 10) throw "Too high"; if(x < 5) throw "Too low"; } catch(err) { message. inner. HTML = "Error: " + err + ". "; } finally { document. get. Element. By. Id("demo"). value = ""; }

The time is? " src="https://present5.com/presentation/53a5e335dbae0f00788b83af7568f9f1/image-10.jpg" alt="Event Handling Handles HTML events " /> Event Handling Handles HTML events

Libraries of Java. Script Prototype Moo. Tools j. Query YUI Ext JS Dojo UIZE Libraries of Java. Script Prototype Moo. Tools j. Query YUI Ext JS Dojo UIZE Many More!

j. Query Most popular Java. Script framework on the internet today Uses CSS selectors j. Query Most popular Java. Script framework on the internet today Uses CSS selectors to access and manipulate HTML elements (DOM Objects) Provides companion UI framework and many other plug-ins Used by Google, Microsoft, IBM, and Netflix

j. Query $ (‘body’). css (‘background’, ‘#ccc’); Java. Script Function change. Bachground(color) { Document. j. Query $ (‘body’). css (‘background’, ‘#ccc’); Java. Script Function change. Bachground(color) { Document. body. style. background = color; }

Prototype Provides a simple API to perform common web tasks API is short for Prototype Provides a simple API to perform common web tasks API is short for Application Programming Interface, and is a library for manipulating the HTML DOM Prototype enhances Java. Script by providing classes and inheritance

Mootools Also a framework that offers an API to make common Java. Script programming Mootools Also a framework that offers an API to make common Java. Script programming easier Includes some lightweight effects and animation functions

Content Delivery Networks Speed is always important with web pages Many web sites use Content Delivery Networks Speed is always important with web pages Many web sites use the same Java. Script framework CDNs solve this by providing a network of servers containing shared code libraries Google provides a free CDN for many Java. Script libraries including: j. Query, Prototype, Mootools, Dojo, and Yahoo! YUI

Other Useful Features AJAX (Asynhronous Java. Script and XML) A way to exchange data Other Useful Features AJAX (Asynhronous Java. Script and XML) A way to exchange data with a server, and update parts of a web page without reloading the whole page https: //www. youtube. com/watch? v=m 1 o 7 Tx. X 9 a. Bg JSON (Java. Script Object Notation) A lightweight data interchange format that is language independent, and easy to understand.

Readability Familiar Syntax Simple Easy to read Libraries such as j. Query can make Readability Familiar Syntax Simple Easy to read Libraries such as j. Query can make reading Java. Script much more condensed

Writability Allows for expressive coding Familiar Syntax Easy to pick up Development is relatively Writability Allows for expressive coding Familiar Syntax Easy to pick up Development is relatively fast Frameworks allow for quick building of Java. Script files

Reliability Widely supported Standardized Run with client resources Many great libraries Reliability Widely supported Standardized Run with client resources Many great libraries

Cost Training is cheap Free IDEs Very portable Easily maintainable Most libraries are also Cost Training is cheap Free IDEs Very portable Easily maintainable Most libraries are also free