Skip to content

Commit 348eab4

Browse files
authored
Merge pull request #217 from javascript-tutorial/sync-540d753e
Sync with upstream @ 540d753
2 parents 05b943c + aa7d9be commit 348eab4

File tree

64 files changed

+2330
-218
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2330
-218
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: iliakan

1-js/01-getting-started/4-devtools/article.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
Изглежда ето така:
2424

25-
![chrome](chrome.png)
25+
![chrome](chrome.webp)
2626

2727
Точният вид на инструментите за разработчици зависи от вашата версия на Chrome. Променя се от време на време, но би трябвало да е подобно на това.
2828

@@ -49,7 +49,11 @@
4949

5050
Safari (браузърът на OС Mac, не се поддържа от ОС Windows/Linux) е малко по-специфичен. Първо трябва да включите/позволите "менюто за разработване".
5151

52+
<<<<<<< HEAD
5253
Отворете свойствата и отидете на панела "Advanced". Има отметка в дъното:
54+
=======
55+
Open Settings and go to the "Advanced" pane. There's a checkbox at the bottom:
56+
>>>>>>> 540d753e90789205fc6e75c502f68382c87dea9b
5357
5458
![safari](safari.png)
5559

-41.1 KB
Binary file not shown.
22.2 KB
Binary file not shown.
48.3 KB
Binary file not shown.
-67.8 KB
Binary file not shown.
83 KB
Loading
Loading

1-js/02-first-steps/04-variables/article.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,26 @@ let user = 'John'
9393
*!*var*/!* message = 'Hello';
9494
```
9595

96+
<<<<<<< HEAD
9697
Ключовата дума `var` е почти същото като на `let`. То също декларира променлива, но е малко по-различен, от стила на "старата школа".
9798

9899
Има тънки различия между `let` и `var`, но засега те не ни засягат. Ще ги разгледаме подробно в главата <info:var>.
100+
=======
101+
The `var` keyword is *almost* the same as `let`. It also declares a variable but in a slightly different, "old-school" way.
102+
103+
There are subtle differences between `let` and `var`, but they do not matter to us yet. We'll cover them in detail in the chapter <info:var>.
104+
>>>>>>> 540d753e90789205fc6e75c502f68382c87dea9b
99105
````
100106
101107
## Аналогия в реалния живот
102108
103109
Лесно можем да схванем концепцията на "променливата", ако я представим като "кутия" с данни, с уникално именуван стикер върху нея.
104110
111+
<<<<<<< HEAD
105112
Например, променливата `message` можем да си въобразим като кутия, наименуван като `"message"`, със стойност `"Hello!"` в нея:
113+
=======
114+
For instance, the variable `message` can be imagined as a box labelled `"message"` with the value `"Hello!"` in it:
115+
>>>>>>> 540d753e90789205fc6e75c502f68382c87dea9b
106116
107117
![ ](variable.svg)
108118
@@ -228,15 +238,23 @@ Variables named `apple` and `APPLE` are two different variables.
228238
```
229239

230240
````smart header="Non-Latin letters are allowed, but not recommended"
241+
<<<<<<< HEAD
231242
It is possible to use any language, including cyrillic letters, Chinese logograms and so on, like this:
232243
>>>>>>> 5dff42ba283bce883428c383c080fa9392b71df8
244+
=======
245+
It is possible to use any language, including Cyrillic letters, Chinese logograms and so on, like this:
246+
>>>>>>> 540d753e90789205fc6e75c502f68382c87dea9b
233247

234248
```js
235249
let имя = '...';
236250
let 我 = '...';
237251
```
238252

253+
<<<<<<< HEAD
239254
Технически няма грешка тука, такива имена са позволени, но има международна традиция да се използва английския език при писане на имена на променливи. Дори ако пишем малък скрипт, това може да има дълъг живот за напред. На хората от други страни може да им се наложи да ги прочетат някое време.
255+
=======
256+
Technically, there is no error here. Such names are allowed, but there is an international convention to use English in variable names. Even if we're writing a small script, it may have a long life ahead. People from other countries may need to read it sometime.
257+
>>>>>>> 540d753e90789205fc6e75c502f68382c87dea9b
240258
````
241259
242260
````warn header="Запазени имена"
@@ -290,17 +308,25 @@ const myBirthday = '18.04.1982';
290308
myBirthday = '01.01.2001'; // грешка, стойността не може да се промени
291309
```
292310
311+
<<<<<<< HEAD
293312
<<<<<<< HEAD
294313
Когато програмистите са сигурни в това, че стойността на променливата никога няма да се промени, тогава те могат да ги декларират с `const` за да са гарантирани в това и ясно да съобщават този факт с всички.
295314
296315
### Константи с главна буква
297316
=======
298317
When a programmer is sure that a variable will never change, they can declare it with `const` to guarantee and clearly communicate that fact to everyone.
318+
=======
319+
When a programmer is sure that a variable will never change, they can declare it with `const` to guarantee and communicate that fact to everyone.
320+
>>>>>>> 540d753e90789205fc6e75c502f68382c87dea9b
299321
300322
### Uppercase constants
301323
>>>>>>> 5dff42ba283bce883428c383c080fa9392b71df8
302324
325+
<<<<<<< HEAD
303326
Има широко разпространена практика да се използват константи като псевдоними за трудно запомнящи се стойности, които са известни преди изпълнението.
327+
=======
328+
There is a widespread practice to use constants as aliases for difficult-to-remember values that are known before execution.
329+
>>>>>>> 540d753e90789205fc6e75c502f68382c87dea9b
304330
305331
Такива константи се назовават с главни букви и подчертаване.
306332
@@ -325,7 +351,11 @@ alert(color); // #FF7F00
325351
326352
Кога трябва да използваме главни букви за константа и кога трябва да я наименуваме нормално? Нека да поясним това.
327353
354+
<<<<<<< HEAD
328355
Това, че "константа", просто означава, че стойността на променливата никога не се променя. Но има константи, които са известни с приоритет преди изпълнението (като шестнадесетична стойност за червено) и има константи, които се *изчисляват* по време на изпълнение, по време на екзекуция на скрипта, но не се променят след първоначалното им присвояване.
356+
=======
357+
Being a "constant" just means that a variable's value never changes. But some constants are known before execution (like a hexadecimal value for red) and some constants are *calculated* in run-time, during the execution, but do not change after their initial assignment.
358+
>>>>>>> 540d753e90789205fc6e75c502f68382c87dea9b
329359

330360
<<<<<<< HEAD
331361
Например:
@@ -337,7 +367,11 @@ For instance:
337367
const pageLoadTime = /* времето, което се е заредил уеб страницата */;
338368
```
339369

370+
<<<<<<< HEAD
340371
Стойността на „pageLoadTime“ не е известна преди зареждането на страницата, така че се наименуван нормално. Но тя все още е константа, защото не се променя след присвояването.
372+
=======
373+
The value of `pageLoadTime` is not known before the page load, so it's named normally. But it's still a constant because it doesn't change after the assignment.
374+
>>>>>>> 540d753e90789205fc6e75c502f68382c87dea9b
341375
342376
<<<<<<< HEAD
343377
С други думи, константи наименувани с главна буква се използват само като псевдоними за "hard-coded" (или кодирани ръчно) стойности.
@@ -351,18 +385,31 @@ In other words, capital-named constants are only used as aliases for "hard-coded
351385
352386
Името на променливата трябва да има чисто и очевидно значение, описващо данните, което съхранява.
353387
388+
<<<<<<< HEAD
354389
Наименуването на променливите е едно от най-важните и сложни умения в програмирането. Бърз поглед към имената на променливите може да разкрие кой код е написан от начинаещ или опитен разработчик.
355390
356391
В реален проект по-голямата част от времето се изразходва за модифициране и разширяване на съществуваща кодова база, а не за писане на нещо напълно отделно от нулата. Когато се върнем към някакъв код, след като направим нещо друго за известно време, е много по-лесно да намерим информация, която е добре етикетирана. Или с други думи, когато променливите имат добри имена.
392+
=======
393+
Variable naming is one of the most important and complex skills in programming. A glance at variable names can reveal which code was written by a beginner versus an experienced developer.
394+
395+
In a real project, most of the time is spent modifying and extending an existing code base rather than writing something completely separate from scratch. When we return to some code after doing something else for a while, it's much easier to find information that is well-labelled. Or, in other words, when the variables have good names.
396+
>>>>>>> 540d753e90789205fc6e75c502f68382c87dea9b
357397

358398
Моля, отделете време за размисъл за правилното име за променливата, преди да я декларирате. Ако направите това, ще ви се отплати щедро.
359399

360400
Някои добри правила за да следваме са:
361401

402+
<<<<<<< HEAD
362403
- Използвайте лесно четими имена за човека като `userName` или `shoppingCart`.
363404
- Стойте далеч от съкращения или кратки имена като `a`, `b`, `c`, освен ако наистина знаеш какво правиш.
364405
- Направете имената максимално описателни и кратки. Примери за лоши имена са `data` и `value`. Такива имена не казват нищо. Добре е да ги използвате само ако контекстът на кода прави изключително очевидно към кои данни или стойности реферират променливите.
365406
- Съгласете се за условията в рамките на вашия екип и в собствения си ум. Ако посетителят на сайта се нарича `user`, тогава трябва да назовем подобни променливи `currentUser` или `newUser` вместо `currentVisitor` или `newManInTown`.
407+
=======
408+
- Use human-readable names like `userName` or `shoppingCart`.
409+
- Stay away from abbreviations or short names like `a`, `b`, and `c`, unless you know what you're doing.
410+
- Make names maximally descriptive and concise. Examples of bad names are `data` and `value`. Such names say nothing. It's only okay to use them if the context of the code makes it exceptionally obvious which data or value the variable is referencing.
411+
- Agree on terms within your team and in your mind. If a site visitor is called a "user" then we should name related variables `currentUser` or `newUser` instead of `currentVisitor` or `newManInTown`.
412+
>>>>>>> 540d753e90789205fc6e75c502f68382c87dea9b
366413

367414
Звучи просто? Наистина е така, но създаването на описателни и кратки имена на променливи на практика не е така. Пробвайте го.
368415

1-js/02-first-steps/05-types/article.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,17 @@ const bigInt = 1234567890123456789012345678901234567890n;
108108
109109
Тъй като номерата на BigInt рядко са необходими, ние не ги обхващаме тук, а им посвещаваме отделна глава <info:bigint>. Прочетете го, когато имате нужда от толкова големи числа.
110110
111+
<<<<<<< HEAD
111112
```smart header="Проблеми със съвместимостта"
112113
В момента `BigInt` се поддържа в Firefox / Chrome / Edge / Safari, но не и в IE.
113114
```
114115
115116
Можете да проверите [таблицата за съвместимост на BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#Browser_compatibility), за да знаете кои версии на браузърите се поддържат.
116117
117118
## Низ
119+
=======
120+
## String
121+
>>>>>>> 540d753e90789205fc6e75c502f68382c87dea9b
118122
119123
Низовете в JavaScript трябва да бъде в кавички.
120124

1-js/02-first-steps/16-function-expressions/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ let sayHi = function() { // (1) create
108108
>>>>>>> c5358c59494b53efb832c81a5338e0a23b22c269
109109
};
110110
111-
let func = sayHi;
111+
let func = sayHi; //(2)
112112
// ...
113113
```
114114

1-js/03-code-quality/06-polyfills/article.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ The JavaScript language steadily evolves. New proposals to the language appear r
1515
So it's quite common for an engine to implement only part of the standard.
1616
>>>>>>> 5dff42ba283bce883428c383c080fa9392b71df8
1717
18+
<<<<<<< HEAD
1819
Добър ресурс, където може да видите кои свойства на езика се поддържат към настоящия момент е <https://kangax.github.io/compat-table/es6/> (доста е голям, а ние имаме да учим още много).
20+
=======
21+
A good page to see the current state of support for language features is <https://compat-table.github.io/compat-table/es6/> (it's big, we have a lot to study yet).
22+
>>>>>>> 540d753e90789205fc6e75c502f68382c87dea9b
1923
2024
Като програмисти, бихме искали да използваме най-новите налични функции. Колкото повече добри неща - толкова по-добре!
2125

@@ -106,13 +110,17 @@ JavaScript е силно динамичен език, скриптовете м
106110
=======
107111
JavaScript is a highly dynamic language. Scripts may add/modify any function, even built-in ones.
108112
113+
<<<<<<< HEAD
109114
Two interesting polyfill libraries are:
110115
- [core js](https://github.com/zloirock/core-js) that supports a lot, allows to include only needed features.
111116
- [polyfill.io](https://polyfill.io/) service that provides a script with polyfills, depending on the features and user's browser.
112117
>>>>>>> 5dff42ba283bce883428c383c080fa9392b71df8
113118
114119
- [core js](https://github.com/zloirock/core-js), който поддържа много, позволява да се включват само необходимите функции.
115120
- [polyfill.io](http://polyfill.io) услуга, която предоставя скрипт с полифили, в зависимост от функциите и браузъра на потребителя.
121+
=======
122+
One interesting polyfill library is [core-js](https://github.com/zloirock/core-js), which supports a wide range of features and allows you to include only the ones you need.
123+
>>>>>>> 540d753e90789205fc6e75c502f68382c87dea9b
116124
117125
## Обобщение
118126
@@ -132,7 +140,13 @@ Just don't forget to use a transpiler (if using modern syntax or operators) and
132140
For example, later when you're familiar with JavaScript, you can setup a code build system based on [webpack](https://webpack.js.org/) with the [babel-loader](https://github.com/babel/babel-loader) plugin.
133141
>>>>>>> 5dff42ba283bce883428c383c080fa9392b71df8
134142
143+
<<<<<<< HEAD
135144
Добри ресурси, които показват текущото състояние на поддръжка за различните нови функции:
145+
=======
146+
Good resources that show the current state of support for various features:
147+
- <https://compat-table.github.io/compat-table/es6/> - for pure JavaScript.
148+
- <https://caniuse.com/> - for browser-related functions.
149+
>>>>>>> 540d753e90789205fc6e75c502f68382c87dea9b
136150
137151
- <https://kangax.github.io/compat-table/es6/> - за чист JavaScript.
138152
- <https://caniuse.com/> - за функции, свързани с браузъра.

1-js/04-object-basics/04-object-methods/8-chain-calls/task.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ importance: 2
44

55
# Chaining
66

7-
There's a `ladder` object that allows to go up and down:
7+
There's a `ladder` object that allows you to go up and down:
88

99
```js
1010
let ladder = {
@@ -21,7 +21,7 @@ let ladder = {
2121
};
2222
```
2323

24-
Now, if we need to make several calls in sequence, can do it like this:
24+
Now, if we need to make several calls in sequence, we can do it like this:
2525

2626
```js
2727
ladder.up();
@@ -32,10 +32,10 @@ ladder.down();
3232
ladder.showStep(); // 0
3333
```
3434

35-
Modify the code of `up`, `down` and `showStep` to make the calls chainable, like this:
35+
Modify the code of `up`, `down`, and `showStep` to make the calls chainable, like this:
3636

3737
```js
3838
ladder.up().up().down().showStep().down().showStep(); // shows 1 then 0
3939
```
4040

41-
Such approach is widely used across JavaScript libraries.
41+
Such an approach is widely used across JavaScript libraries.

1-js/04-object-basics/09-object-toprimitive/article.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,11 @@ let obj = {
354354
}
355355
};
356356

357+
<<<<<<< HEAD
357358
alert(obj + 2); // 22 ("2" + 2), преобразуване в примитивен връща низ => конкатенация
359+
=======
360+
alert(obj + 2); // "22" ("2" + 2), conversion to primitive returned a string => concatenation
361+
>>>>>>> 540d753e90789205fc6e75c502f68382c87dea9b
358362
```
359363

360364
## Обобщение

0 commit comments

Comments
 (0)