Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function expressions #29

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

BitcoinElf
Copy link

German Translation of article Function Expressions

@javascript-translate-bot javascript-translate-bot added the review needed Review needed, please approve or request changes label Mar 31, 2020
@javascript-translate-bot javascript-translate-bot requested a review from a team March 31, 2020 11:36
@CLAassistant
Copy link

CLAassistant commented Mar 31, 2020

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@christianhegedues christianhegedues left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @BitcoinElf vielen Dank für deinen Pull-Request.
Ich habe nur bis zur Zeile 43 eine Review durchgeführt, da irgendwo ab Zeile 40 die Formatierung des Originals verloren geht. Kannst du das bitte wieder anpassen, danach werden ich mir den Rest ansehen.

@@ -1,70 +1,67 @@
# Function expressions
# Function Expressions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Function Expressions
# Funktionsausdruck


The syntax that we used before is called a *Function Declaration*:
Bisher haben wir die Syntax *Function Declaration* benutzt.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Bisher haben wir die Syntax *Function Declaration* benutzt.
Die Syntax, die wir zuvor verwendet haben, wird *Funktionsdeklaration* genannt:


```js
function sayHi() {
alert( "Hello" );
}
```

There is another syntax for creating a function that is called a *Function Expression*.
Es gibt allerdings auch die Syntax namens *Function Expression*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Es gibt allerdings auch die Syntax namens *Function Expression*
Es gibt eine weitere Syntax zum Erstellen einer Funktion, die als *Funktionsausdruck* bezeichnet wird.


It looks like this:
Diese sieht so aus:

```js
let sayHi = function() {
alert( "Hello" );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
alert( "Hello" );
alert( "Hallo" );


```js
let sayHi = function() {
alert( "Hello" );
};
```

Here, the function is created and assigned to the variable explicitly, like any other value. No matter how the function is defined, it's just a value stored in the variable `sayHi`.
Hier wird die Funktion erstellt und einer Variable explizit zugewiesen, wie jeder andere Wert. Unabhängig davon, wie die Funktion definiert ist, ist sie nur ein Wert, den wir in der variable `sayHi` speichern.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Hier wird die Funktion erstellt und einer Variable explizit zugewiesen, wie jeder andere Wert. Unabhängig davon, wie die Funktion definiert ist, ist sie nur ein Wert, den wir in der variable `sayHi` speichern.
Hier wird die Funktion erstellt und einer Variable explizit zugewiesen, wie jeder andere Wert. Unabhängig davon, wie die Funktion definiert ist, ist sie nur ein Wert, den wir in der Variable `sayHi` speichern.

*/!*
```

Please note that the last line does not run the function, because there are no parentheses after `sayHi`. There are programming languages where any mention of a function name causes its execution, but JavaScript is not like that.
Interessanterweise führt die letzte Zeile die Funktion nicht aus, denn hinter `sayHi` befinden sich keine Klammern. In einigen Programmiersprachen führt jede Erwähnung einer Funktion zur Ausführung, JavaScript gehört nicht dazu.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Interessanterweise führt die letzte Zeile die Funktion nicht aus, denn hinter `sayHi` befinden sich keine Klammern. In einigen Programmiersprachen führt jede Erwähnung einer Funktion zur Ausführung, JavaScript gehört nicht dazu.
Bitte beachte, dass die letzte Zeile die Funktion nicht ausführt, da nach `sayHi` keine Klammern stehen. In einigen Programmiersprachen führt jede Erwähnung einer Funktion zur Ausführung, JavaScript gehört nicht dazu.


In JavaScript, a function is a value, so we can deal with it as a value. The code above shows its string representation, which is the source code.
In JavaScript ist eine Funktion ein Wert, also können wir damit auch umgehen, wie mit einem Wert. Der obige code zeigt die Funktion als String an, zeigt also den Quellcode.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In JavaScript ist eine Funktion ein Wert, also können wir damit auch umgehen, wie mit einem Wert. Der obige code zeigt die Funktion als String an, zeigt also den Quellcode.
In JavaScript ist eine Funktion ein Wert, so dass wir sie als Wert behandeln können. Der obige Code zeigt seine Zeichenkettendarstellung, die den Quellcode darstellt.


```js run no-beautify
function sayHi() { // (1) create
function sayHi() { // (1) erstellen
alert( "Hello" );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
alert( "Hello" );
alert( "Hallo" );


func(); // Hello // (3) run the copy (it works)!
sayHi(); // Hello // this still works too (why wouldn't it)
func(); // Hello // (3) Kopie ausführen(klappt)!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func(); // Hello // (3) Kopie ausführen(klappt)!
func(); // Hallo // (3) führe die Kopie aus (es funktioniert)!

func(); // Hello // (3) run the copy (it works)!
sayHi(); // Hello // this still works too (why wouldn't it)
func(); // Hello // (3) Kopie ausführen(klappt)!
sayHi(); // Hello // Die Funktion funktioniert immernoch (warum auch nicht?)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sayHi(); // Hello // Die Funktion funktioniert immernoch (warum auch nicht?)
sayHi(); // Hallo // das funktioniert immer noch (warum sollte es nicht)

@javascript-translate-bot javascript-translate-bot added changes requested Waiting for changes and /done from PR author and removed review needed Review needed, please approve or request changes labels Apr 5, 2020
@javascript-translate-bot

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes requested Waiting for changes and /done from PR author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants