Javascript

Reviews
Shared by: zzzmarcus
Categories
Tags
Stats
views:
40
rating:
not rated
reviews:
0
posted:
5/21/2009
language:
UNKNOWN
pages:
0
From Wikipedia, the free encyclopedia JavaScript JavaScript JavaScript Paradigm Multi-paradigm: prototypebased, functional, imperative, scripting 1995 Brendan Eich Netscape Communications Corporation, Mozilla Foundation 1.8/ 2008 dynamic, weak, duck SpiderMonkey, Rhino, KJS, JavaScriptCore, V8 JScript, JScript .NET Self, C, Scheme, Perl, Python, Java Objective-J Appeared in Designed by Developer Latest release Typing discipline Major implementations Dialects Influenced by Influenced conventions. The language’s name is the result of a co-marketing deal between Netscape and Sun, in exchange for Netscape bundling Sun’s Java runtime with their then-dominant browser. The key design principles within JavaScript are inherited from the Self and Scheme programming languages.[3] "JavaScript" is a trademark of Sun Microsystems. It was used under license for technology invented and implemented by Netscape Communications and current entities such as the Mozilla Foundation.[4] History and naming JavaScript was originally developed by Brendan Eich of Netscape under the name Mocha, which was later renamed to LiveScript, and finally to JavaScript.[5] The change of name from LiveScript to JavaScript roughly coincided with Netscape adding support for Java technology in its Netscape Navigator web browser. JavaScript was first introduced and deployed in the Netscape browser version 2.0B3 in December 1995. The naming has caused confusion, giving the impression that the language is a spin-off of Java, and it has been characterized by many as a marketing ploy by Netscape to give JavaScript the cachet of what was then the hot new web-programming language.[6][7] Due to the widespread success of JavaScript as a client-side scripting language for web pages, Microsoft developed a compatible dialect of the language, naming it JScript to avoid trademark issues. JScript added new date methods to fix the non-Y2Kfriendly methods in JavaScript, which were based on java.util.Date.[2] JScript was included in Internet Explorer 3.0, released in August 1996. The dialects are perceived to be so similar that the terms "JavaScript" and "JScript" are often used interchangeably. Microsoft, however, notes dozens of ways in which JScript is not ECMA compliant. Netscape submitted JavaScript to Ecma International for standardization resulting in the standardized version named [8] ECMAScript. This article is part of the JavaScript series. JavaScript JavaScript syntax ECMAScript JavaScript topics JavaScript is a scripting language used to enable programmatic access to objects within other applications. It is primarily used in the form of client-side JavaScript for the development of dynamic websites. JavaScript is a dialect of the ECMAScript standard and is characterized as a dynamic, weakly typed, prototype-based language with first-class functions. JavaScript was influenced by many languages and was designed to look like Java, but to be easier for non-programmers to work with.[1][2] JavaScript, despite the name, is essentially unrelated to the Java programming language even though the two do have superficial similarities. Both languages use syntaxes influenced by that of C syntax, and JavaScript copies many Java names and naming 1 From Wikipedia, the free encyclopedia The flexibility of JavaScript has made it one of the most popular programming languages on the web and also one of the easier languages to learn. Initially, however, many professional programmers denigrated the language because its target audience was web authors and other such "amateurs", among other reasons.[9] The advent of AJAX returned JavaScript to the spotlight and brought more professional programming attention. The result was a proliferation of comprehensive frameworks and libraries, improved JavaScript programming practices, and increased usage of JavaScript outside of the web. JavaScript • array and object destructuring (limited form of pattern matching) • concise function expressions (function(args) expr) • E4X Syntax and semantics As of 2008, the latest version of the language is JavaScript 1.8. It is a superset of ECMAScript (ECMA-262) Edition 3. Extensions to the language, including partial E4X (ECMA-357) support and experimental features considered for inclusion into ECMAScript Edition 4, are documented here.[11] Sample code showcasing various JavaScript features: Features The following features are common to all conforming ECMAScript implementations, unless explicitly specified otherwise. Imperative and structured JavaScript supports all the structured programming syntax in C (e.g., if statements, while loops, switch statements, etc.). One partial exception is scoping: C-style blocklevel scoping is not supported. JavaScript 1.7, however, supports block-level scoping with the let keyword. Like C, JavaScript makes a distinction between expressions and statements. Dynamic Functional Prototype-based Miscellaneous JavaScript-specific JavaScript is officially managed by Mozilla, and new language features are added periodically, but few non-Mozilla "JavaScript" engines support these new features: • conditional catch clauses • property getter and setter functions • iterator protocol adopted from Python • shallow generators/coroutines also adopted from Python • array comprehensions and generator expressions also adopted from Python • proper block scope via new let keyword function LCMCalculator(x, y) { // constructor function checkInt(x) { // inner function if (x % 1 != 0) throw new TypeError(x + " is not a return x; } this.a = checkInt(x); this.b = checkInt(y); this.ab = this.a * this.b; } // The prototype of object instances created b LCMCalculator.prototype = { // object literal gcd : function() { // Euclidean algorithm: var a = Math.abs(this.a), b = Math.abs if (a < b) { var t = b; b = a; a = t; // swap v } while (b != 0) { t = b; // |t| already declared abo b = a % b; a = t; } // Only need to calculate gcd once, so // (Actually not redefinition - it’s d // so that this.gcd refers to this "re // Also, ’gcd’ == "gcd", this[’gcd’] = this[’gcd’] = function() { return a; } return a; }, lcm : function() { // Variable names don’t collide with o var lcm = this.ab / this.gcd(); // Only need to calculate lcm once, so this.lcm = function() { return lcm; }; return lcm; }, 2 From Wikipedia, the free encyclopedia JavaScript toString : function() { and JavaScript dispatches requests for inreturn "LCMCalculator: a = " + this.a + (such = " + this.b;of an e-mail formation ", b as the content } message) to the server. The wider trend of }; Ajax programming similarly exploits this [[25,55],[21,56],[22,58],[28,56]].map(function(pair) { // array literal + mapping fun strength. return new LCMCalculator(pair[0], pair[1]); A JavaScript engine (also known as }).sort(function(a, b) { // sort with this comparative function JavaScript interpreter or JavaScript implereturn a.lcm() - b.lcm(); mentation) is an interpreter that interprets }).forEach(function(obj) { JavaScript source code and executes the /* Note: print() is a JS builtin function available The Mozilla’sJavaScriptinterpret script accordingly. in first ever js CLI * it’s functionally equivalent to Java’s was created by Brendan Eich at Netsengine System.out.println(). * Within a web browser, print() is cape Communications Corporation, for the "Print P a very different function (opens the * so use something like document.write() instead. Netscape Navigator web browser. The */ engine, code-named SpiderMonkey, is impleprint(obj + ", gcd = " + obj.gcd() + ", lcm = "It+ has since been updated (in obj.lcm()); mented in C. }); JavaScript 1.5) to conform to ECMA-262 Edi// Note: Array’s map() and forEach() are predefined in engine, created primarily tion 3. The Rhino JavaScript 1.6. // They are currently not available in all major JavaScript of Netscape; now at by Norris Boyd (formerly engines (including Intern // but are shown here to demonstrate JavaScript’s ainherent functional nature. Google) is JavaScript implementation in Java. Rhino, like SpiderMonkey, is ECMA-262 The output is: Edition 3 compliant. The most common host environment for LCMCalculator: a = 28, b = 56, gcd = 28, lcm = 56 by far a web browser. Web JavaScript is LCMCalculator: a = 21, b = 56, gcd = 7, browsers typically use the public API to crelcm = 168 LCMCalculator: a = 25, b = 55, gcd = 5, ate "host objects" responsible for reflecting lcm = 275 LCMCalculator: a = 22, b = 58, gcd = 2, the DOM into JavaScript. The web server is lcm = 638 another common application of the engine. A JavaScript webserver would expose host objects representing an HTTP request and reSee also: Ajax (programming) sponse objects, which a JavaScript program The primary use of JavaScript is to write could then manipulate to dynamically generfunctions that are embedded in or included ate web pages. from HTML pages and interact with the A minimal example of a standards-conDocument Object Model (DOM) of the page. forming web page containing JavaScript (usSome simple examples of this usage are: ing HTML 4.01 syntax) would be: • Opening or popping up a new window with programmatic control over the size, (i.e. whether the menus, toolbars, etc. are visible). simple page • Validation of web form input values to make sure that they will be accepted moves over them: This effect is often used
Related docs
JAVASCRIPT
Views: 190  |  Downloads: 31
JavaScript
Views: 3  |  Downloads: 0
Javascript Tutorial
Views: 891  |  Downloads: 144
JavaScript
Views: 9  |  Downloads: 0
Javascript
Views: 19  |  Downloads: 0
JavaScript
Views: 27  |  Downloads: 0
JavaScript
Views: 13  |  Downloads: 4
The Secret Of Javascript
Views: 386  |  Downloads: 40
javascript libraries
Views: 185  |  Downloads: 15
Javascript
Views: 15  |  Downloads: 2
Javascript jQuery
Views: 1133  |  Downloads: 110
Javascript
Views: 9  |  Downloads: 1
JavaScript _ jQuery
Views: 7  |  Downloads: 2
Javascript Tutorial Download
Views: 515  |  Downloads: 53
premium docs
Other docs by zzzmarcus
Winneshiek_County__Iowa
Views: 957  |  Downloads: 3
Winner-take-all
Views: 801  |  Downloads: 2
Winnebago_County__Iowa
Views: 694  |  Downloads: 0
Winnebago_County__Illinois
Views: 575  |  Downloads: 0
Winnebago_-tribe-
Views: 701  |  Downloads: 1
Winn_Parish
Views: 548  |  Downloads: 0
Wings_Over_Vietnam
Views: 915  |  Downloads: 2
Winfield_S._Hancock
Views: 557  |  Downloads: 0
Windsurfing
Views: 1143  |  Downloads: 1
Windsor_Locks
Views: 542  |  Downloads: 0
Windsor_Locks__Connecticut
Views: 507  |  Downloads: 0
Windsor_County
Views: 506  |  Downloads: 0
Windsor_County__Vermont
Views: 461  |  Downloads: 0
Windows_Presentation_Foundation
Views: 652  |  Downloads: 2
Windows_on_the_World
Views: 611  |  Downloads: 1