Skip to content

Function expressions #93

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

Closed
wants to merge 2 commits into from
Closed

Function expressions #93

wants to merge 2 commits into from

Conversation

kplich
Copy link

@kplich kplich commented Feb 25, 2021

Translated the article into Polish.

@CLAassistant
Copy link

CLAassistant commented Feb 25, 2021

CLA assistant check
All committers have signed the CLA.

Copy link

@Onxi95 Onxi95 left a comment

Choose a reason for hiding this comment

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

For future reference - please don't replace the colons with brackets, don't add extra bold, emoji, etc. This may change the context of the original text :)


In JavaScript, a function is not a "magical language structure", but a special kind of value.
W JavaScripcie, funkcje nie są "magicznymi konstrukcjami językowymi", lecz po prostu rodzajem wartości.
Copy link

Choose a reason for hiding this comment

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

Please replace lecz po prostu rodzajem wartości by lecz szczególnym rodzajem wartości - it shouldn't change the context of the original sentence :)

};
```

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`.
Funkcja jest tworzona i przypisywana do zmiennej - tak, jakby była to zwykła wartość. Nie ważne, w jaki sposób zostanie ona zdefiniowana - będzie to po prostu wartość, przechowywana w zmiennej `sayHi`.
Copy link

Choose a reason for hiding this comment

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

You skipped the word explicitly. Pleace change: Funkcja jest tworzona i przypisywana do zmiennej to Funkcja jest tworzona i jawnie przypisywana do zmiennej.


Let's look at more examples of passing functions as values and using function expressions.
Spójrzmy na kolejne przykład przekazywania funkcji jako wartości oraz wykorzystania wyrażeń funkcyjnych.
Copy link

Choose a reason for hiding this comment

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

typo! Please replace przykład by przykłady - plural form :)

@@ -121,24 +121,24 @@ function ask(question, yes, no) {
*/!*

function showOk() {
alert( "You agreed." );
alert( "Może być." );
Copy link

Choose a reason for hiding this comment

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

Please replace Może być by Zgoda została wyrażona. I thought about Zgodziłeś się but then the expression does not have a female version. Any other ideas?

}

function showCancel() {
alert( "You canceled the execution." );
alert( "Nie chcesz nic wywoływać." );
Copy link

Choose a reason for hiding this comment

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

Please replace Nie chcesz nic wywoływać by Wykonanie zostało anulowane.

let sum = function(a, b) {
return a + b;
};
```

The more subtle difference is *when* a function is created by the JavaScript engine.
Bardziej subtelną różnicą jest różnica w *momencie tworzenia* funkcji przez silnik JavaScriptu.
Copy link

Choose a reason for hiding this comment

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

Pleace replace Bardziej subtelną różnicą jest różnica w *momencie tworzenia* funkcji przez silnik JavaScriptu. by Bardziej subtelną różnicą jest to *kiedy* funkcja jest tworzona przez silnik JavaScriptu.


That's due to internal algorithms. When JavaScript prepares to run the script, it first looks for global Function Declarations in it and creates the functions. We can think of it as an "initialization stage".
Wynika to z algorytmu wykonywania skryptu. Przygotowując skrypt do wykonania, JavaScript najpierw wyszukuje w nim globalnych deklaracji funkcji, a następnie je tworzy - można nazwać to etapem "inicjalizacji".
Copy link

Choose a reason for hiding this comment

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

Replace Wynika to z algorytmu wykonywania skryptu. by Wynika to z wewnętrznego algorytmu wykonywania skryptu.

@@ -294,75 +294,75 @@ if (age < 18) {
}
}

// Here we're out of curly braces,
// so we can not see Function Declarations made inside of them.
// Skończyły nam się klamerki,
Copy link

Choose a reason for hiding this comment

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

klamerki may be confusing. Pleace replace it by nawiasy klamrowe.


...But if a Function Declaration does not suit us for some reason, or we need a conditional declaration (we've just seen an example), then Function Expression should be used.
Dopiero jeśli z jakichś powodów deklaracja funkcji nie odpowiada naszym potrzebom (kiedy, jak w przykładzie, potrzebujemy warunkowej deklaracji funkcji), wtedy można rozważyć użycie wyrażenia funkcyjnego.
Copy link

Choose a reason for hiding this comment

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

Pleace replace
Dopiero jeśli z jakichś powodów deklaracja funkcji nie odpowiada naszym potrzebom (kiedy, jak w przykładzie, potrzebujemy warunkowej deklaracji funkcji)
by
Dopiero jeśli z jakichś powodów deklaracja funkcji nie odpowiada naszym potrzebom, albo potrzebujemy warunkowej deklaracji funkcji (jak w przykładzie powyżej)

  • I think it is more meaningful :)


...But if a Function Declaration does not suit us for some reason, or we need a conditional declaration (we've just seen an example), then Function Expression should be used.
Dopiero jeśli z jakichś powodów deklaracja funkcji nie odpowiada naszym potrzebom (kiedy, jak w przykładzie, potrzebujemy warunkowej deklaracji funkcji), wtedy można rozważyć użycie wyrażenia funkcyjnego.
```

## Summary
Copy link

Choose a reason for hiding this comment

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

Replace Summary by Podsumowanie :)

@javascript-translate-bot

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

@kplich kplich closed this Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants