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

Fix typos and links #652

Merged
merged 1 commit into from Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions modules/35-calling-functions/350-stdlib/description.en.yml
Expand Up @@ -9,9 +9,9 @@ theory: |

Here are some tips to learn about new features:

* Always keep track of what you are working with (the data type) at the moment. You will most likely find the function you need in the appropriate chapter of the documentation. For example, you need to study string functions to work with strings.
* From time to time, open the standard functions section of the topic you are studying and just run through them, learning the signatures and ways to use them.
* Read other people's code more often, especially code from the libraries you're using. It's all available on GitHub.
* Always keep track of what you are working with (the data type) at the moment. You will most likely find the function you need in the appropriate chapter of the documentation. For example, you need to study string functions to work with strings
* From time to time, open the standard functions section of the topic you are studying and just run through them, learning the signatures and ways to use them
* Read other people's code more often, especially code from the libraries you're using. It's all available on GitHub

The JavaScript standard library's structure has its peculiarities. Since the code can run in different environments, such as a server or a browser, the capabilities of the standard library are highly dependent on the use case. For example, you can't perform some server tasks in a browser. For server-side documentation, see https://nodejs.org. The server portions of the standard library are organized into modules, each module has its own page with full descriptions of all its functions. In particular, the module [fs](https://nodejs.org/api/fs.html) is required to work with the file system, its functions allow you to write and read files.

Expand All @@ -31,7 +31,7 @@ tips:
- |
[String functions docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)
- |
[How to search for technical information](https://guides.hexlet.io/how_to_search/)
[How to search for technical information](https://guides.hexlet.io/how-to-search/)

definitions:
- name: Standard library
Expand Down
Expand Up @@ -3,7 +3,7 @@
name: Properties
theory: |

The data we utilize in our programs can have vital properties, for example, strings have length. As you will see later, this property is required to implement string conversion algorithms (e.g., string reversal). So how do you find out the length of a string? In many languages, string length is calculated with a special function, and it looks a bit like this:
The data we use in our programs can have important properties, such as strings having length. As you will see later, this property is required to implement string conversion algorithms (e.g., string reversal). So how do you find out the length of a string? In many languages, string length is calculated with a special function, and it looks a bit like this:

```javascript
import { length } from 'hexlet-basics/string';
Expand Down
Expand Up @@ -33,12 +33,12 @@ theory: |

There are two reasons why it's done that way:

1. It's just always been like that. JavaScript was developed a little too quickly, so not everything was well thought out.
2. Not all functions are linked to a specific value. For example, `Math.min()`. This function finds the minimum of all numbers passed to it. It doesn't make sense to make this function a method of a particular number, like `(1).min()`. It has no connection to any particular number.
1. It's just always been like that. JavaScript was developed a little too quickly, so not everything was well thought out
2. Not all functions are linked to a specific value. For example, `Math.min()`. This function finds the minimum of all numbers passed to it. It doesn't make sense to make this function a method of a particular number, like `(1).min()`. It has no connection to any particular number

On the other hand, functions that work with a particular number should be implemented as methods for the sake of consistency. Such functions include calculating the modulus of a number. I.e., instead of `Math.abs(-10)`, it's more reasonable to have `(-10).abs()`.

As for methods in general, things are not so straightforward. Some languages have no methods and have no issues. Other languages use methods as the main tool for building functions, and even here regular functions are always used along with methods. JavaScript is a language that uses both approaches and actively uses both normal functions and methods.
As for methods in general, things are not so straightforward. Some languages have no methods and have no issues. Other languages use methods as the main tool for building functions, and even here regular functions are always used along with methods. JavaScript is a language that uses both approaches and actively uses both normal functions and methods.

instructions: |
Convert the string text to lowercase and print it.
Expand Down
Expand Up @@ -33,8 +33,8 @@ theory: |

Есть две причины почему так сделано:

1. Исторически так сложилось. JavaScript разрабатывался слишком быстро и поэтому не все было продумано хорошо.
2. Далеко не все функции имеют отношение к конкретному значению. Возьмем для примера `Math.min()`. Эта функция находит минимальное число среди всех, которые ему были переданы. Эту функцию нелогично делать методом конкретного числа, например, так — `(1).min()`. Она не имеет никакой связи с конкретным числом.
1. Исторически так сложилось. JavaScript разрабатывался слишком быстро и поэтому не все было продумано хорошо
2. Далеко не все функции имеют отношение к конкретному значению. Возьмем для примера `Math.min()`. Эта функция находит минимальное число среди всех, которые ему были переданы. Эту функцию нелогично делать методом конкретного числа, например, так — `(1).min()`. Она не имеет никакой связи с конкретным числом

С другой стороны, функции, работающие с конкретным числом, для единообразия должны быть реализованы как методы. К таким функциям относится получение модуля числа. То есть вместо такого вызова `Math.abs(-10)`, логично иметь такой: `(-10).abs()`.

Expand Down
Expand Up @@ -51,7 +51,7 @@ theory: |
console.log(name.toUpperCase().toLowerCase().length.toString().length);
```

_This kind of trick won't work with functions because they are usually nested, f(f(f())), which complicates analysis. Yet this doesn't mean that you can't do it nicely - you can and should. Other languages implement it by composing functions or using a pipeline operator, which, incidentally, is starting to be used more and more in JavaScript: https://github.com/tc39/proposal-pipeline-operator_
_This trick won't work with functions because they are usually nested, f(f(f())), which complicates analysis. Yet this doesn't mean that you can't do it nicely - you can and should. Other languages implement it by composing functions or using a pipeline operator, which, incidentally, is starting to be used more and more in JavaScript: https://github.com/tc39/proposal-pipeline-operator.

instructions: |

Expand Down
Expand Up @@ -51,7 +51,7 @@ theory: |
console.log(name.toUpperCase().toLowerCase().length.toString().length);
```

_С функциями подобный трюк не сработает, так как при обычном использовании они вкладываются друг в друга f(f(f())), что значительно ухудшает анализ. Но это не значит, что нельзя сделать красиво — можно и даже нужно. В других языках это реализуется через композицию функций или пайплайн-оператор, который, кстати говоря, постепенно начинает использоваться и в самом JavaScript: https://github.com/tc39/proposal-pipeline-operator_
_С функциями подобный трюк не сработает, так как при обычном использовании они вкладываются друг в друга f(f(f())), что значительно ухудшает анализ. Но это не значит, что нельзя сделать красиво — можно и даже нужно. В других языках это реализуется через композицию функций или пайплайн-оператор, который, кстати говоря, постепенно начинает использоваться и в самом JavaScript: https://github.com/tc39/proposal-pipeline-operator.

instructions: |

Expand Down
Expand Up @@ -29,7 +29,7 @@ theory: |
// The definition doesn't call or execute a function
// We're just declaring this function exists now
const showGreeting = () => {
// Use 2-space indents inside the function body for readability
// Use 2-space indents inside the function body for readability
const text = 'Hello, Hexlet!';
console.log(text);
}
Expand Down