Editing JavaScript 1 Einführung
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 136: | Line 136: | ||
console.log("Meine Lieblingszahl ist " + favNumber + " , meine Liebelingsfarbe ist " + favColor + " , mein Lieblingstier ist " + favAnimal); | console.log("Meine Lieblingszahl ist " + favNumber + " , meine Liebelingsfarbe ist " + favColor + " , mein Lieblingstier ist " + favAnimal); | ||
//Verwendung von Template | //Verwendung von Template Strings | ||
console.log(`Meine Lieblingszahl ist ${favNumber}, meine Lieblingsfarbe ist ${favColor}, mein Lieblingstier ist ${favAnimal}`); | console.log(`Meine Lieblingszahl ist ${favNumber}, meine Lieblingsfarbe ist ${favColor}, mein Lieblingstier ist ${favAnimal}`); | ||
</pre> | </pre> | ||
Line 143: | Line 143: | ||
*Variablen, Berechnungen und logische Ausdrücke werden in '''${}''' gesteckt | *Variablen, Berechnungen und logische Ausdrücke werden in '''${}''' gesteckt | ||
*Template Strings erlauben mehrzeilige Strings | *Template Strings erlauben mehrzeilige Strings | ||
*Mit Template | *Mit Template Strings kann man noch mehr machen: | ||
<pre> | <pre> | ||
//innerhalb von Template | //innerhalb von Template Strings können Berechnungen erfolgen: | ||
console.log(`4 mal 5 ist ${4 * 5}`); | console.log(`4 mal 5 ist ${4 * 5}`); | ||
Line 156: | Line 156: | ||
</pre> | </pre> | ||
====const - Konstanten verwenden==== | ====const - Konstanten verwenden==== |