Geschrieben von Student*innen, die bestanden haben Sofort verfügbar nach Zahlung Online lesen oder als PDF Falsches Dokument? Kostenlos tauschen 4,6 TrustPilot
logo-home
Zusammenfassung

Samenvatting JavaScript

Bewertung
-
Verkauft
2
seiten
11
Hochgeladen auf
16-12-2021
geschrieben in
2021/2022

Samenvatting van het begrip Javascript. alle te kennen informatie verwerkt in dit bestand. van het keuzevak creating value using social media van Jan Moons.

Hochschule
Kurs

Inhaltsvorschau

JAVASCRIPT
VARIABLES
New variables in JavaScript are declared using one of three keywords: let, const, or var.

let allows you to declare block-level variables. The declared variable is available from the block it
is enclosed in.

let a;


let name = 'Simon';


The following is an example of scope with a variable declared with let:

// myLetVariable is *not* visible out here




for (let myLetVariable = 0; myLetVariable < 5; myLetVariable++) {


// myLetVariable is only visible in here


}




// myLetVariable is *not* visible out here


const allows you to declare variables whose values are never intended to change. The variable is
available from the block it is declared in.

const Pi = 3.14; // variable Pi is set


Pi = 1; // will throw an error because you cannot change a constant variable.


varis the most common declarative keyword. It does not have the restrictions that the other two
keywords have. This is because it was traditionally the only way to declare a variable in
JavaScript. A variable declared with the var keyword is available from the function it is declared in.

var a;


var name = 'Simon';


An example of scope with a variable declared with var:

// myVarVariable *is* visible out here

, for (var myVarVariable = 0; myVarVariable < 5; myVarVariable++) {


// myVarVariable is visible to the whole function


}




// myVarVariable *is* visible out here


If you declare a variable without assigning any value to it, its type is undefined.

An important difference between JavaScript and other languages like Java is that in JavaScript,
blocks do not have scope; only functions have a scope. So if a variable is defined using var in a
compound statement (for example inside an if control structure), it will be visible to the entire
function. However, starting with ECMAScript 2015, let and const declarations allow you to create
block-scoped variables.


OPERATORS

JavaScript's numeric operators are +, -, *, / and % which is the remainder operator (which is the
same as modulo.) Values are assigned using =, and there are also compound assignment
statements such as += and -=. These extend out to x = x operator y.

x += 5;


x = x + 5;


You can use ++ and -- to increment and decrement respectively. These can be used as a prefix or
postfix operators.

The + operator also does string concatenation:

'hello' + ' world'; // "hello world"


If you add a string to a number (or other value) everything is converted into a string first. This
might trip you up:

'3' + 4 + 5; // "345"


3 + 4 + '5'; // "75"


Adding an empty string to something is a useful way of converting it to a string itself.

Comparisons in JavaScript can be made using <, >, <= and >=. These work for both strings and
numbers. Equality is a little less straightforward. The double-equals operator performs type
coercion if you give it different types, with sometimes interesting results:

Schule, Studium & Fach

Hochschule
Studium
Kurs

Dokument Information

Hochgeladen auf
16. dezember 2021
Anzahl der Seiten
11
geschrieben in
2021/2022
Typ
ZUSAMMENFASSUNG

Themen

$4.09
Vollständigen Zugriff auf das Dokument erhalten:

Falsches Dokument? Kostenlos tauschen Innerhalb von 14 Tagen nach dem Kauf und vor dem Herunterladen kannst du ein anderes Dokument wählen. Du kannst den Betrag einfach neu ausgeben.
Geschrieben von Student*innen, die bestanden haben
Sofort verfügbar nach Zahlung
Online lesen oder als PDF

Lerne den Verkäufer kennen

Seller avatar
Bewertungen des Ansehens basieren auf der Anzahl der Dokumente, die ein Verkäufer gegen eine Gebühr verkauft hat, und den Bewertungen, die er für diese Dokumente erhalten hat. Es gibt drei Stufen: Bronze, Silber und Gold. Je besser das Ansehen eines Verkäufers ist, desto mehr kannst du dich auf die Qualität der Arbeiten verlassen.
Handelswetenschapperugent Universiteit Gent
Folgen Sie müssen sich einloggen, um Studenten oder Kursen zu folgen.
Verkauft
151
Mitglied seit
5 Jahren
Anzahl der Follower
102
Dokumente
14
Zuletzt verkauft
2 Jahren vor
Handelswetenschapper @Ugent

3.5

11 rezensionen

5
3
4
2
3
4
2
1
1
1

Warum sich Studierende für Stuvia entscheiden

on Mitstudent*innen erstellt, durch Bewertungen verifiziert

Geschrieben von Student*innen, die bestanden haben und bewertet von anderen, die diese Studiendokumente verwendet haben.

Nicht zufrieden? Wähle ein anderes Dokument

Kein Problem! Du kannst direkt ein anderes Dokument wählen, das besser zu dem passt, was du suchst.

Bezahle wie du möchtest, fange sofort an zu lernen

Kein Abonnement, keine Verpflichtungen. Bezahle wie gewohnt per Kreditkarte oder Sofort und lade dein PDF-Dokument sofort herunter.

Student with book image

“Gekauft, heruntergeladen und bestanden. So einfach kann es sein.”

Alisha Student

Arbeitest du an deiner Quellenangabe?

Erstelle korrekte Quellenangaben in APA, MLA und Harvard mit unserem kostenlosen Zitiergenerator.

Arbeitest du an deiner Quellenangabe?

Häufig gestellte Fragen