JavaScript Language Specification

Read Online or Download JavaScript Language Specification PDF

Best programming: programming languages books

Objektorientierte Programmiersprache C++: Vollständige Einführung anhand von Beispielen (VDI-Buch) (German Edition)

In diesem Werk werden alle Aspekte der Sprache C++ behandelt, deshalb ist das Buch ebenso für Einsteiger, mit oder ohne Vorkenntnisse über eine andere Programmiersprache, als auch für Umsteiger von anderen Programmiersprachen bzw. C-Programmierer geeignet. Die Darstellung der Sachverhalte erfolgt knapp und systematisch, die Beispiele sind kurz, prägnant und compiler- unabhängig und auf allen Rechnern mit C++ 2.

Extra info for JavaScript Language Specification

Sample text

The function parameter effectively ceases to exist when the execution of the body of the function is complete. 2 Initial Values of Variables Every variable in a JavaScript program has a value: • If the variable is assigned a value in its declaration or its initial use, then it has that value, otherwise its value is undefined. • Each function parameter is initialized to the corresponding argument value provided in the invocation of the function, otherwise its value is undefined. A local variable must be explicitly given a value (other than undefined) before it is used, by either initialization or assignment, or a run-time error results.

0 is Not-a-Number: NaN inexact results with floating point arithmetic: 49 98 This example demonstrates, among other things, that gradual underflow can result in a gradual loss of precision. Note that when i is zero, z is NaN, and z*i is NaN. 1 Bitwise integer operations The bitwise operators treat their operands as signed 32-bit integer values: • The signed and unsigned shift operators <<, >>, and >>> • The bitwise complement operator ~ • The integer bitwise operators &, |, and ^ JavaScript uses round toward zero when converting a floating-point value to an integer, which acts, in this case, as though the number were truncated, discarding the mantissa bits.

In determining the meaning of a name, JavaScript takes into account the context in which the name appears. It distinguishes among contexts where a name must denote (refer to) a type, a variable or value in an expression, or a function. Not all identifiers in JavaScript programs are a part of a name. 1 Declarations and Scoping JavaScript variables may be declared by assignment or by use of the var statement. For example, both of the following statements declare the variable x: x = 42 var x = 42 A variable declared outside a function is a global variable, and is accessible everywhere in the global scope.

Download PDF sample

Rated 4.74 of 5 – based on 36 votes