Host Programmer Reference Script Window

JavaScript is an object-oriented scripting language used to enable programmatic access to objects within both the client application and other applications. It is primarily used in the form of client-side JavaScript, implemented as an integrated component of the web browser, allowing the development of enhanced user interfaces and 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.

History

JavaScript was originally developed by Brendan Eich of Netscape under the name Mocha , which was later renamed to LiveScript , and finally to JavaScript. 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.

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

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

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-Y2K-friendly methods in JavaScript, which were based on java.util.Date. 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 ECMAScript.

JavaScript has become one of the most popular programming languages on the web. Initially, however, many professional programmers denigrated the language because its target audience was web authors and other such "amateurs", among other reasons. 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 browser, as seen by the proliferation of server-side JavaScript platforms.

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 block-level scoping is not supported (instead, JavaScript has function-level scoping). JavaScript 1.7, however, supports block-level scoping with the let keyword. Like C, JavaScript makes a distinction between expressions and statements. One syntactic difference from C is automatic semicolon insertion, in which the semicolons that terminate statements can be omitted.

Dynamic

Functional

Prototype-based

Miscellaneous

Vendor-specific extensions

JavaScript is officially managed by Mozilla, and new language features are added periodically. However, only some non-Mozilla JavaScript engines support these new features:

  • property getter and setter functions (also supported by WebKit, Opera, ActionScript, and Rhino)
  • conditional catch clauses
  • 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
  • array and object destructuring (limited form of pattern matching)
  • concise function expressions ( function(args) expr )
  • E4X

Syntax and semantics

Main article: JavaScript syntax

As of 2009, the latest version of the language is JavaScript 1.8.1. 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 future ECMAScript editions, are documented here.

Sample code showcasing various JavaScript features:

              
                /* Finds the lowest common multiple of two numbers */
              
              
                function
              
              LCMCalculator
              
                (
              
              x
              
                ,
              
              y
              
                )
              
              
                {
              
              
                // constructor function
              
              
                function
              
              checkInt
              
                (
              
              x
              
                )
              
              
                {
              
              
                // inner function
              
              
                if
              
              
                (
              
              x
              
                %
              
              1
              
                !=
              
              0
              
                )
              
              
                throw
              
              
                new
              
              TypeError
              
                (
              
              x
              
                +
              
              
                " is not an integer"
              
              
                )
              
              
                ;
              
              
                // exception throwing
              
              
                return
              
              x
              
                ;
              
              
                }
              
              
                //semicolons are optional (but beware since this may cause consecutive lines to be
              
              
                //erroneously treated as a single statement)
              
              
                this
              
              .
              
                a
              
              
                =
              
              checkInt
              
                (
              
              x
              
                )
              
              
                this
              
              .
              
                b
              
              
                =
              
              checkInt
              
                (
              
              y
              
                )
              
              
                }
              
              
                // The prototype of object instances created by a constructor is
              
              
                // that constructor's "prototype" property.
              
              LCMCalculator.
              
                prototype
              
              
                =
              
              
                {
              
              
                // object literal
              
              gcd
              
                :
              
              
                function
              
              
                (
              
              
                )
              
              
                {
              
              
                // method that calculates the greatest common divisor
              
              
                // Euclidean algorithm:
              
              
                var
              
              a
              
                =
              
              Math.
              
                abs
              
              
                (
              
              
                this
              
              .
              
                a
              
              
                )
              
              
                ,
              
              b
              
                =
              
              Math.
              
                abs
              
              
                (
              
              
                this
              
              .
              
                b
              
              
                )
              
              
                ;
              
              
                if
              
              
                (
              
              a
              
                <
              
              b
              
                )
              
              
                {
              
              
                var
              
              t
              
                =
              
              b
              
                ;
              
              b
              
                =
              
              a
              
                ;
              
              a
              
                =
              
              t
              
                ;
              
              
                // swap variables
              
              
                }
              
              
                while
              
              
                (
              
              b
              
                !==
              
              0
              
                )
              
              
                {
              
              t
              
                =
              
              b
              
                ;
              
              
                // |t| already declared above (though we could redeclare if we wish)
              
              b
              
                =
              
              a
              
                %
              
              b
              
                ;
              
              a
              
                =
              
              t
              
                ;
              
              
                }
              
              
                // Only need to calculate gcd once, so "redefine" this method.
              
              
                // (Actually not redefinition - it's defined on the instance itself,
              
              
                // so that this.gcd refers to this "redefinition" instead of LCMCalculator.prototype.gcd.)
              
              
                // Also, 'gcd' == "gcd", this == this.gcd
              
              
                this
              
              
              
              
                =
              
              
                function
              
              
                (
              
              
                )
              
              
                {
              
              
                return
              
              a
              
                ;
              
              
                }
              
              
                ;
              
              
                return
              
              a
              
                ;
              
              
                }
              
              
                ,
              
              
                "lcm"
              
              
                /* can use strings here */
              
              
                :
              
              
                function
              
              
                (
              
              
                )
              
              
                {
              
              
                // Variable names don't collide with object properties, e.g. |lcm| is not |this.lcm|.
              
              
                // not using |this.a * this.b| to avoid FP precision issues
              
              
                var
              
              lcm
              
                =
              
              
                this
              
              .
              
                a
              
              
                /
              
              
                this
              
              .
              
                gcd
              
              
                (
              
              
                )
              
              
                *
              
              
                this
              
              .
              
                b
              
              
                ;
              
              
                // Only need to calculate lcm once, so "redefine" this method.
              
              
                this
              
              .
              
                lcm
              
              
                =
              
              
                function
              
              
                (
              
              
                )
              
              
                {
              
              
                return
              
              lcm
              
                ;
              
              
                }
              
              
                ;
              
              
                return
              
              lcm
              
                ;
              
              
                }
              
              
                ,
              
              toString
              
                :
              
              
                function
              
              
                (
              
              
                )
              
              
                {
              
              
                return
              
              
                "LCMCalculator: a = "
              
              
                +
              
              
                this
              
              .
              
                a
              
              
                +
              
              
                ", b = "
              
              
                +
              
              
                this
              
              .
              
                b
              
              
                ;
              
              
                }
              
              
                }
              
              
                ;
              
              
              
              
                ,
              
              
              
              
                ,
              
              
              
              
                ,
              
              
              
              
                ]
              
              .
              
                map
              
              
                (
              
              
                function
              
              
                (
              
              pair
              
                )
              
              
                {
              
              
                // array literal + mapping function
              
              
                return
              
              
                new
              
              LCMCalcu
            

Windows Script Host Programmer's Reference: Amazon.co ...

Windows Script Host Programmer's Reference [Illustrated] (Paperback) ... system administrator or Windows programmer, Dino Esposito's Windows Scripting Host Programmer's Reference ...

...

Amazon.com: Windows Script Host Programmer's Reference ...

Amazon.com: Windows Script Host Programmer's Reference (9781861002655): Dino, Dino Esposito: Books

...

InterClasse - Scripting Books

... Enterprise Systems with the Windows Script Host ... Windows Script Host Programmer's Reference By Dino Esposito Publisher : Wrox Press, Inc ISBN : 1861002653: Windows NT/2000: ADSI Scripting ...

...

How to create a desktop shortcut with the Windows ...

The Microsoft Windows Script Host (WSH) is a tool that ... Script Host: A universal Scripting Host for scripting languages Technical Paper: Windows Script Host programmer's reference

...

Windows Script Host COM Client

Windows Script Host is a client that ... is completed, the script will have a live reference ... Integrator Programmer’s Guide Introduction to COM and COM+ Windows Script Host COM ...

...

Windows Script Host COM Client

... the script to load Windows Script Host ... Programmer's Reference Application Integration Programmer's Reference Introduction to COM and COM+ Windows Script Host COM Client

...

How to use the Windows Script Host to read, write, and ...

The Microsoft Windows Script Host (WSH) is a tool that ... Script Host: A Universal Scripting Host for scripting languages; Technical paper: Windows Script Host programmer's reference

...

www.cs.odu.edu

' Windows Script Host Programmer's Reference Installation Script ' -----Option Explicit

...

Windows Script Host

I definately recommend this as part of a good programmer's reference library. Similar Products · Windows Script Host Programmer's Reference · Microsoft Windows Script Host 2.0 ...

...

Amazon.com: Windows Script Host (0619472701393 ...

Windows Script Host Programmer's Reference. by Dino ... Windows Script Host explains the latest Windows scripting technology, focusing on ...

...