JavaScript/Introduction

From Wikibooks, open books for an open world
Jump to navigation Jump to search
  Index Next: Relation to other languages

JavaScript is an interpreted computer programming language formalized in the ECMAScript language standard. JavaScript engines interpret and execute JavaScript. JavaScript engines may be designed for use as standalone interpretors, embedding in applications, or both. The first JavaScript engine was created by Netscape for embedding in their Web browser. V8 is a JavaScript engine created for use in Google Chrome and may also be used as a standalone interpretor. Adobe Flash uses a JavaScript engine called ActionScript for development of Flash programs.

Relation to Java

JavaScript has no relation to Java aside from having a C-like syntax. Netscape developed JavaScript, and Sun Microsystems developed Java. The rest of this section assumes a background in programming. You may skip to the next section, if you like.

Variables have a static type (integer or string for example) that remains the same during the lifespan of a running program in Java, and have a dynamic type (Number or String for example) that can change during the lifespan of a running program in JavaScript. Variables must be declared prior to use in Java, and have a undefined value when referred to prior to assignment in JavaScript.

Java has an extensive collection of libraries that can be imported for use in programs. JavaScript does not provide any means to import libraries or external JavaScript code. JavaScript engines must extend the JavaScript language beyond the ECMAScript language standard, if additional functionality is desired, such as the required functionality provided by V8, or the Document Object Model found in many Web browsers.

Java includes classes and object instances, and JavaScript uses prototypes.

About this book

This book is written as a tutorial, in the sense that all key concepts are explained. As such, it also contains exercises that are clearly marked as such at the end of a page or chapter. Answers for these exercises are also included.

The book can also be used as a reference. For this purpose, all keywords are mentioned and described.

Audience

This book assumes you have good knowledge and some experience in the use of computers, Web browsers, text editors, and software development environments. As you will not learn about HTML, CSS, Java, or website design in this book, consult an appropriate book to learn about these subjects.


  Index Next: Relation to other languages