• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 5 pages
Summary

Zusammenfassung Einführung JavaScript

Document preview thumbnail
Preview 2 out of 5 pages

Dies ist ein Dokument, das ich für einen Kurs in der 10 Klasse für JavaScript geschrieben habe. In diesem Dokument lernt man die Basics der Programmierung mit dieser Sprache. Es gibt ein Paket-Preis mit HTML& CSS & JavaScript um alles umfassend zu verstehen.

Content preview

JavaScript Grundlagen für Spieleentwicklung

1. Variablen

Variablen werden verwendet, um Werte zu speichern, die sich während der Ausführung
eines Programms ändern können. In JavaScript gibt es zwei wichtige Arten von
Variablen:

 const: Der Wert einer const-Variable kann nach ihrer Zuweisung nicht mehr
verändert werden.

 let: Der Wert einer let-Variable kann jederzeit geändert werden.

Beispiel:

const maxScore = 100; // Der Wert von maxScore kann nicht
verändert werden
let currentScore = 0; // Der Wert von currentScore kann
verändert werden
currentScore = 50; // Jetzt ist der Wert von currentScore 50



2. If Statements

Ein if-Statement prüft eine Bedingung und führt einen Codeblock aus, wenn die
Bedingung true ist.

Beispiel:

let score = 50;

if (score >= 100) {
console.log("Du hast gewonnen!");
}
Das else Statement:

Ein else-Statement wird ausgeführt, wenn die Bedingung des if-Statements nicht
zutri t.

if (score >= 100) {
console.log("Du hast gewonnen!");
} else {
console.log("Weiter spielen!");
}
Das else if Statement:

Mit else if kannst du mehrere Bedingungen hintereinander prüfen.

if (score >= 100) {
console.log("Du hast gewonnen!");
} else if (score >= 50) {
console.log("Gute Arbeit, noch ein bisschen mehr!");

, } else {
console.log("Du kannst es schaffen!");
}


3. Schleifen

Schleifen sind wichtig, um einen Codeblock mehrfach auszuführen.

For-Schleife:

Die for-Schleife wird verwendet, wenn du weißt, wie oft der Code ausgeführt werden
soll.

for (let i = 0; i < 5; i++) {
console.log("Schritt " + (i + 1));
}
While-Schleife:

Die while-Schleife wird so lange ausgeführt, wie eine bestimmte Bedingung erfüllt ist.

let count = 0;
while (count < 5) {
console.log("Schritt " + (count + 1));
count++;
}


Do/While-Schleife:

Die do/while-Schleife führt den Code mindestens einmal aus und überprüft danach die
Bedingung.

let attempts = 0;
do {
console.log("Versuch " + (attempts + 1));
attempts++;
} while (attempts < 3);


4. Funktionen

Funktionen sind Blöcke von Code, die ausgeführt werden, wenn sie aufgerufen werden.
Sie sind hilfreich, um wiederkehrende Aufgaben zu vereinfachen.

Beispiel:

function greet(name) {
console.log("Hallo, " + name + "!");
}
greet("Max"); // Ausgabe: Hallo, Max!

Document information

Study
Gymnasium
School year
1
Uploaded on
November 17, 2025
Number of pages
5
Written in
2024/2025
Type
Summary
$9.80

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
1
Followers
0
Items
7
Last sold
11 months ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions