GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Notizen

Getting Started

Deepak Kumar Core JavaScript Intermediate Englisch 1 Seite

Inhalt der Notizen (1)

Seite 1

JavaScript is case-sensitive and uses the Unicode character set. In JavaScript, instructions are called statements and are separated by a semicolon (;). It is recommended to always add semicolons to end your statements; it will avoid side effects.

Spaces, tabs and newline characters are called whitespace. The source text of JavaScript scripts gets scanned from left to right and is converted into a sequence of input elements which are tokens, control characters, line terminators, comments or whitespace.

Comments

The syntax of comments is the same as in C++ and in many other languages:

// a one line comment /* this is a longer, multi-line comment */ /* You can't, however, /* nest comments */ SyntaxError */

Variables

You use variables as symbolic names for values in your application. The names of variables, called identifiers, conform to certain rules.

A JavaScript identifier must start with a letter, underscore (_), or dollar sign ($); subsequent characters can also be digits (0-9). Because JavaScript is case sensitive, letters include the characters "A" through "Z" (uppercase) and the characters "a" through "z" (lowercase).

There are three kinds of declarations in JavaScript:

var : Declares a variable, optionally initializing it to a value.

let : Declares a block scope local variable, optionally initializing it to a value.

const : Declares a read-only named constant.

You can declare a variable in three ways:

With the keyword var. For example, var x = 42. This syntax can be used to declare both local and global variables.

By simply assigning it a value. For example, x = 42. This always declares a global variable, if it is declared outside of any function. It generates a strict JavaScript warning. You shouldn't use this variant.

With the keyword let. For example, let y = 13. This syntax can be used to declare a block scope local variable. See Variable scope below.

Note: A variable declared using the var or let statement with no initial value specified has the value undefined. An attempt to access an undeclared variable will result in a ReferenceError exception being thrown. The undefined value behaves as false when used in a boolean context.

Informationen

Beschreibung
Getting Started with JavaScript
Erstellt von
Deepak Kumar
Aufrufe
23
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck