Skip to content

Commit 6054748

Browse files
committed
feat: ЁЯО╕ support nepali language for all content
1 parent 070548a commit 6054748

Some content is hidden

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

94 files changed

+196
-1374
lines changed

тАОen/numbers/operators.mdтАО

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ parseInt("40 years"); //40
6262
parseInt("He was 40"); //NaN
6363
```
6464

65-
In JavaScript, if we calculate a number outside the largest possible number it returns `Infinity` .
65+
In JavaScript, if we calculate a number outside the largest possible number it returns `Infinity`.
6666

6767
```javascript
6868
let x = 2 / 0; // Infinity

тАОen/objects/mutable.mdтАО

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ myObject.key = "another value";
1515

1616
You can add, modify, or delete properties of an object using the dot notation or the square bracket notation.
1717

18-
```python
18+
```javascript
1919
let object = {};
2020
object.foo = 'bar'; // Add property 'foo'
2121
object['baz'] = 'qux'; // Add property 'baz'

тАОne/README.mdтАО

Lines changed: 9 additions & 39 deletions
Large diffs are not rendered by default.

тАОne/SUMMARY.mdтАО

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Table of contents
2-
3-
# рд╕рд╛рдордЧреНрд░реАрдХреЛ рддрд╛рд▓рд┐рдХрд╛
1+
рд╕рд╛рдордЧреНрд░реА рддрд╛рд▓рд┐рдХрд╛
42

53
* [рдкрд░рд┐рдЪрдп](README.md)
64
* [рдЖрдзрд╛рд░рднреВрдд рдХреБрд░рд╛](basics/README.md)

тАОne/arrays/README.mdтАО

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,23 @@
1-
# Arrays (рдПрд░реЗ)
2-
3-
Arrays are a fundamental part of programming. An array is a list of data. We can store a lot of data in one variable, which makes our code more readable and easier to understand. It also makes it much easier to perform functions on related data.
1+
# рдПрд░реЗ
42

53
рдПрд░реЗрд╣рд░реВ рдкреНрд░реЛрдЧреНрд░рд╛рдорд┐рдВрдЧрдХреЛ рдПрдХ рдореМрд▓рд┐рдХ рднрд╛рдЧ рд╣реЛред рдПрд░реЗ рдбреЗрдЯрд╛рдХреЛ рд╕реВрдЪреА рд╣реЛред рд╣рд╛рдореА рдПрдХ рдЪрд░рдорд╛ рдзреЗрд░реИ рдбреЗрдЯрд╛ рднрдгреНрдбрд╛рд░рдг рдЧрд░реНрди рд╕рдХреНрджрдЫреМрдВ, рдЬрд╕рд▓реЗ рд╣рд╛рдореНрд░реЛ рдХреЛрдбрд▓рд╛рдИ рдЕрдзрд┐рдХ рдкрдардиреАрдп рд░ рдмреБрдЭреНрди рд╕рдЬрд┐рд▓реЛ рдмрдирд╛рдЙрдБрджрдЫред рдпрд╕рд▓реЗ рд╕рдореНрдмрдиреНрдзрд┐рдд рдбреЗрдЯрд╛рдорд╛ рдкреНрд░рдХрд╛рд░реНрдпрд╣рд░реВ рдкреНрд░рджрд░реНрд╢рди рдЧрд░реНрди рдзреЗрд░реИ рд╕рдЬрд┐рд▓реЛ рдмрдирд╛рдЙрдБрджрдЫред
64

7-
The data in arrays are called **elements**.
8-
95
рдПрд░реЗрдорд╛ рдбреЗрдЯрд╛рд▓рд╛рдИ **рддрддреНрд╡** рднрдирд┐рдиреНрдЫред
106

11-
Here is a simple array:
12-
137
рдпрд╣рд╛рдБ рдПрдХ рд╕рд╛рдзрд╛рд░рдг рдПрд░реНрд░реЗрдХреЛ рдЙрджрд╛рд╣рд░рдг рдЫред
148

159
```javascript
1610
// 1, 1, 2, 3, 5, and 8 are the elements in this array
1711
let numbers = [1, 1, 2, 3, 5, 8];
1812
```
1913

20-
Arrays can be created easily using array literals or with a `new` keyword. 
21-
2214
рдПрд░реЗрд╣рд░реВ рдПрд░реЗ рд╢рд╛рдмреНрджрд┐рдХ рдкреНрд░рдпреЛрдЧ рдЧрд░реЗрд░ рд╡рд╛ `рдирдпрд╛рдБ` рдХреБрдЮреНрдЬреАрд╢рдмреНрджрдХреЛ рд╕рд╛рде рд╕рдЬрд┐рд▓реИ рд╕рд┐рд░реНрдЬрдирд╛ рдЧрд░реНрди рд╕рдХрд┐рдиреНрдЫред
2315

2416
```javascript
2517
const cars = ["Saab", "Volvo", "BMW"]; // using array literals
2618
const cars = new Array("Saab", "Volvo", "BMW"); // using the new keyword
2719
```
2820

29-
An index number is used to access the values of an array. The index of the first element in an array is always `0` as array indexes start with `0`. The index number can also be used to change the elements of an array.
30-
3121
рдЕрдиреБрдХреНрд░рдордгрд┐рдХрд╛ рдирдореНрдмрд░ рдПрд░реЗрдХреЛ рдорд╛рдирдорд╛ рдкрд╣реБрдБрдЪ рдЧрд░реНрди рдкреНрд░рдпреЛрдЧ рдЧрд░рд┐рдиреНрдЫ ред рдПрд░реЗрдорд╛ рдкрд╣рд┐рд▓реЛ рддрддреНрд╡рдХреЛ рдЕрдиреБрдХреНрд░рдордгрд┐рдХрд╛ рдЬрд╣рд┐рд▓реЗ рдкрдирд┐ 'реж' рд╣реБрдиреНрдЫ рдХрд┐рдирдХрд┐ рдПрд░реЗ рдЕрдиреБрдХреНрд░рдордгрд┐рдХрд╛рд╣рд░реВ 'реж' рдмрд╛рдЯ рд╕реБрд░реБ рд╣реБрдиреНрдЫред рдЕрдиреБрдХреНрд░рдордгрд┐рдХрд╛ рдирдореНрдмрд░ рдкрдирд┐ рдПрд░реЗрдХреЛ рддрддреНрд╡рд╣рд░реВ рдкрд░рд┐рд╡рд░реНрддрди рдЧрд░реНрди рдкреНрд░рдпреЛрдЧ рдЧрд░реНрди рд╕рдХрд┐рдиреНрдЫред
3222

3323
```javascript
@@ -42,44 +32,9 @@ console.log(cars);
4232

4333
{% hint style="warning" %}
4434

45-
46-
Arrays are a special type of object. One can have [objects](../objects/) in an array.
47-
4835
рдПрд░реЗрд╣рд░реВ рдПрдХ рд╡рд┐рд╢реЗрд╖ рдкреНрд░рдХрд╛рд░рдХреЛ рд╡рд╕реНрддреБ рд╣реЛред рдПрд░реЗрдорд╛ [рд╡рд╕реНрддреБрд╣рд░реВ](../objects/) рд╣реБрди рд╕рдХреНрдЫрдиреНред
4936
{% endhint %}
5037

51-
 The `length` property of an array returns the count of numbers elements. Methods supported by Arrays are shown below:
52-
53-
| Name | Description |
54-
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
55-
| `concat()` | Returns two or more combined arrays |
56-
| `join()` | Joins all elements in an array into a string |
57-
| `push()` | Adds one or more elements at the end of the array and returns the length |
58-
| `pop()` | Removes the last element of an array and returns that element |
59-
| `shift()` | Removes the first element of an array and returns that element |
60-
| `unshift()` | Adds one or more elements at the front of an array and returns the length |
61-
| `slice()` | Extracts the section of an array and returns the new array |
62-
| `at()` | Returns element at the specified index or `undefined` |
63-
| `splice()` | Removes elements from an array and (optionally) replaces them, and returns the array |
64-
| `reverse()` | Transposes the elements of an array and returns a reference to an array |
65-
| `flat()` | Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth |
66-
| `sort()` | Sorts the elements of an array in place, and returns a reference to the array |
67-
| `indexOf()` | Returns the index of the first match of the search element |
68-
| `lastIndexOf()` | Returns the index of the last match of the search element |
69-
| `forEach()` | Executes a callback in each element of an array and returns undefined |
70-
| `map()` | Returns a new array with a return value from executing `callback` on every array item. |
71-
| `flatMap()` | Runs `map()` followed by `flat()` of depth 1 |
72-
| `filter()` | Returns a new array containing the items for which `callback` returned `true` |
73-
| `find()` | Returns the first item for which `callback` returned `true` |
74-
| `findLast()` | Returns the last item for which `callback` returned `true` |
75-
| `findIndex()` | Returns the index of the first item for which `callback` returned `true` |
76-
| `findLastIndex()` | Returns the index of the last item for which `callback` returned `true` |
77-
| `every()` | Returns `true` if `callback` returns `true` for every item in the array |
78-
| `some()` | Returns `true` if `callback` returns `true` for at least one item in the array |
79-
| `reduce()` | Uses `callback(accumulator, currentValue, currentIndex, array)` for reducing purpose and returns the final value returned by `callback` function |
80-
| `reduceRight()` | Works similarly lie `reduce()` but starts with the last element |
81-
82-
8338
рдПрд░реЗрдХреЛ 'рд▓рдореНрдмрд╛рдЗ' рдЧреБрдгрд▓реЗ рд╕рдВрдЦреНрдпрд╛ рддрддреНрд╡рд╣рд░реВрдХреЛ рдЧрдгрдирд╛ рдлрд░реНрдХрд╛рдЙрдБрдЫред рдПрд░реЗрджреНрд╡рд╛рд░рд╛ рд╕рдорд░реНрдерд┐рдд рд╡рд┐рдзрд┐рд╣рд░реВ рддрд▓ рджреЗрдЦрд╛рдЗрдПрдХреЛ рдЫ:
8439

8540

тАОne/arrays/for-each.mdтАО

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# For Each (рдкреНрд░рддреНрдпреЗрдХрдХреЛ рд▓рд╛рдЧрд┐)
2-
3-
The `forEach` method executes a provided function once for each array element. Here's the syntax for using `forEach`:
1+
# рдкреНрд░рддреНрдпреЗрдХрдХреЛ рд▓рд╛рдЧрд┐
42

53
`рдлреЛрд░рдПрдЪ` рд╡рд┐рдзрд┐рд▓реЗ рдкреНрд░рддреНрдпреЗрдХ рд╕рд░рдгреА рддрддреНрд╡рдХрд╛ рд▓рд╛рдЧрд┐ рдПрдХ рдкрдЯрдХ рдкреНрд░рджрд╛рди рдЧрд░рд┐рдПрдХреЛ рдкреНрд░рдХрд╛рд░реНрдп рдХрд╛рд░реНрдпрд╛рдиреНрд╡рдпрди рдЧрд░реНрджрдЫ ред рдпрд╣рд╛рдБ 'рдлреЛрд░рдПрдЪ' рдкреНрд░рдпреЛрдЧ рдЧрд░реНрдирдХрд╛ рд▓рд╛рдЧрд┐ рд╡рд╛рдХреНрдпрд░рдЪрдирд╛ рдЫред
64

@@ -12,9 +10,6 @@ array.forEach(function(element, index, array) {
1210
});
1311
```
1412

15-
16-
For example, let's say you have an array of numbers and you want to print the double of each number to the console. You could do this using `forEach` like this:
17-
1813
рдЙрджрд╛рд╣рд░рдгрдХрд╛ рд▓рд╛рдЧрд┐, рдорд╛рдиреМрдБ рдХрд┐ рддрдкрд╛рдИрдВрд╕рдБрдЧ рд╕рдВрдЦреНрдпрд╛рд╣рд░реВрдХреЛ рд╕рд░рдгреА рдЫ рд░ рддрдкрд╛рдИрдВ рдХрдиреНрд╕реЛрд▓рдорд╛ рдкреНрд░рддреНрдпреЗрдХ рдирдореНрдмрд░рдХреЛ рдбрдмрд▓ рдореБрджреНрд░рдг рдЧрд░реНрди рдЪрд╛рд╣рдиреБрд╣реБрдиреНрдЫред рддрдкрд╛рдИрдВ 'рдлреЛрд░рдПрдЪ' рдкреНрд░рдпреЛрдЧ рдЧрд░реЗрд░ рдпреЛ рдЧрд░реНрди рд╕рдХреНрдиреБрд╣реБрдиреЗрдЫ:
1914

2015
```typescript
@@ -24,8 +19,6 @@ numbers.forEach(function(number) {
2419
});
2520
```
2621

27-
You can also use the arrow function syntax to define the function passed to `forEach`:
28-
2922
рддрдкрд╛рдИрдБрд▓реЗ `рдлреЛрд░рдПрдЪ` рдорд╛ рдкрд╛рд╕ рдЧрд░рд┐рдПрдХреЛ рдкреНрд░рдХрд╛рд░реНрдп рдкрд░рд┐рднрд╛рд╖рд┐рдд рдЧрд░реНрди рдмрд╛рдг рдкреНрд░рдХрд╛рд░реНрдп рд╡рд╛рдХреНрдпрд░рдЪрдирд╛ рдкрдирд┐ рдкреНрд░рдпреЛрдЧ рдЧрд░реНрди рд╕рдХреНрдиреБрд╣реБрдиреНрдЫ ред
3023

3124
```typescript
@@ -42,14 +35,9 @@ or
4235
numbers.forEach(number => console.log(number * 2));
4336
```
4437

45-
 `forEach` does not modify the original array. It simply iterates over the elements of the array and executes the provided function for each element.
46-
4738
`рдлреЛрд░рдПрдЪ` рд▓реЗ рдореВрд▓ рдПрд░реНрд░реЗ рдкрд░рд┐рдорд╛рд░реНрдЬрди рдЧрд░реНрджреИрди ред рдпреЛ рдХреЗрд╡рд▓ рдПрд░реНрд░реЗрдХреЛ рддрддреНрд╡рд╣рд░реВрдорд╛ рдкреБрдирд░рд╛рд╡реГрддреНрддрд┐ рдЧрд░реНрджрдЫ рд░ рдкреНрд░рддреНрдпреЗрдХ рддрддреНрд╡рдХреЛ рд▓рд╛рдЧрд┐ рдкреНрд░рджрд╛рди рдЧрд░рд┐рдПрдХреЛ рдкреНрд░рдХрд╛рд░реНрдп рдХрд╛рд░реНрдпрд╛рдиреНрд╡рдпрди рдЧрд░реНрджрдЫред
4839

4940
{% hint style="warning" %}
5041

51-
52-
The `forEach()` method is not executed for the empty statment.
53-
5442
рдЦрд╛рд▓реА рдХрдердирдХрд╛ рд▓рд╛рдЧрд┐ `forEach()` рд╡рд┐рдзрд┐ рдХрд╛рд░реНрдпрд╛рдиреНрд╡рдпрди рдЧрд░рд┐рдПрдХреЛ рдЫреИрди ред
5543
{% endhint %}

тАОne/arrays/indices.mdтАО

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Indices (рд╕реВрдЪрдХрд╛рдВрдХ)
2-
3-
So you have your array of data elements, but what if you want to access a specific element? That is where indices come in. An **index** refers to a spot in the array. indices logically progress one by one, but it should be noted that the first index in an array is 0, as it is in most languages. Brackets `[]` are used to signify you are referring to an index of an array.
1+
# рд╕реВрдЪрдХрд╛рдВрдХ
42

53
рддрдкрд╛рдЗрдБрд╕рдБрдЧ рдбреЗрдЯрд╛ рддрддреНрд╡рд╣рд░реВрдХреЛ рддрдкрд╛рдИрдВрдХреЛ рдПрд░реЗ рдЫ, рддрд░ рдпрджрд┐ рддрдкрд╛рдИрдВ рдПрдХ рд╡рд┐рд╢рд┐рд╖реНрдЯ рддрддреНрд╡ рдкрд╣реБрдБрдЪ рдЧрд░реНрди рдЪрд╛рд╣рдиреБрд╣реБрдиреНрдЫ рднрдиреЗ рдХреЗ рд╣реБрдиреНрдЫ? рдпрд╣реАрдБрдмрд╛рдЯ рдЗрдиреНрдбреЗрдХреНрд╕ рдЖрдЙрдБрдЫ ред рдПрдХ **рдЕрдиреБрдХреНрд░рдордгрд┐рдХрд╛** рд▓реЗ рд╕рд░рдгреАрдорд╛ рдПрдХ рд╕реНрдерд╛рдирд▓рд╛рдИ рдмреБрдЭрд╛рдЙрдБрдЫред рд╕реВрдЪрдХрд╛рдВрдХрд╣рд░реВ рддрд╛рд░реНрдХрд┐рдХ рд░реВрдкрдорд╛ рдПрдХ-рдПрдХ рдЧрд░реЗрд░ рдкреНрд░рдЧрддрд┐ рдЧрд░реНрдЫрдиреН, рддрд░ рдпреЛ рдзреНрдпрд╛рди рджрд┐рдиреБрдкрд░реНрджрдЫ рдХрд┐ рдПрд░реЗрдорд╛ рдкрд╣рд┐рд▓реЛ рдЕрдиреБрдХреНрд░рдордгрд┐рдХрд╛ реж рд╣реЛ, рдХрд┐рдирдХрд┐ рдпреЛ рдЕрдзрд┐рдХрд╛рдВрд╢ рднрд╛рд╖рд╛рд╣рд░реВрдорд╛ рдЫред рддрдкрд╛рдИрдБрд▓реЗ рд╕рд░рдгреАрдХреЛ рдЕрдиреБрдХреНрд░рдордгрд┐рдХрд╛рд▓рд╛рдИ рд╕рдЩреНрдХреЗрдд рдЧрд░реНрджреИ рд╣реБрдиреБрд╣реБрдиреНрдЫ рднрдиреНрдиреЗ рд╕рдЩреНрдХреЗрдд рдЧрд░реНрди рдХреЛрд╖реНрдардХ `[]` рдкреНрд░рдпреЛрдЧ рдЧрд░рд┐рдиреНрдЫ ред
64

@@ -14,19 +12,15 @@ let fruits = ["apple", "banana", "pineapple", "strawberry"];
1412
let banana = fruits[1];
1513
```
1614

17-
You can also use an array index to set the value of an element in an array:
18-
1915
рддрдкрд╛рдИрдБрд▓реЗ рд╕рд░рдгреАрдорд╛ рддрддреНрд╡рдХреЛ рдорд╛рди рд╕реЗрдЯ рдЧрд░реНрди рд╕рд░рдгреА рдЕрдиреБрдХреНрд░рдордгрд┐рдХрд╛ рдкрдирд┐ рдкреНрд░рдпреЛрдЧ рдЧрд░реНрди рд╕рдХреНрдиреБрд╣реБрдиреНрдЫ ред
2016

21-
```sql
17+
```javascript
2218
let array = ['a', 'b', 'c', 'd', 'e'];
2319
// indices: 0 1 2 3 4
2420
array[4] = 'f';
2521
console.log(array); // Result: ['a', 'b', 'c', 'd', 'f']
2622
```
2723

28-
Note that if you try to access or set an element using an index that is outside the bounds of the array (i.e., an index that is less than 0 or greater than or equal to the length of the array), you will get an `undefined` value.
29-
3024
рдпрд╛рдж рдЧрд░реНрдиреБрд╣реЛрд╕реН рдХрд┐ рдпрджрд┐ рддрдкрд╛рдИрдБрд▓реЗ рд╕рд░рдгреАрдХреЛ рд╕реАрдорд╛ рднрдиреНрджрд╛ рдмрд╛рд╣рд┐рд░рдХреЛ рдЕрдиреБрдХреНрд░рдордгрд┐рдХрд╛ рдкреНрд░рдпреЛрдЧ рдЧрд░реЗрд░ рддрддреНрд╡ рдкрд╣реБрдБрдЪ рдЧрд░реНрди рд╡рд╛ рд╕реЗрдЯ рдЧрд░реНрди рдкреНрд░рдпрд╛рд╕ рдЧрд░реНрдиреБрднрдпреЛ рднрдиреЗ (рдЬрд╕реНрддреИ, реж рднрдиреНрджрд╛ рдХрдо рд╡рд╛ рд╕рд░рдгреАрдХреЛ рд▓рдореНрдмрд╛рдЗрднрдиреНрджрд╛ рдмрдвреА рд╡рд╛ рдмрд░рд╛рдмрд░ рдЕрдиреБрдХреНрд░рдордгрд┐рдХрд╛), рддрдкрд╛рдИрдБрд▓реЗ `рдЕрдкрд░рд┐рднрд╛рд╖рд┐рдд` рдорд╛рди рдкреНрд░рд╛рдкреНрдд рдЧрд░реНрдиреБрд╣реБрдиреЗрдЫред
3125

3226
```javascript

тАОne/arrays/join.mdтАО

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
1-
# Join (рд╕рд╛рдореЗрд▓)
2-
3-
The `join` method, makes an array turn into a string and joins it all together. It does not change the original array. Here's the syntax for using `join`:
1+
# рд╕рд╛рдореЗрд▓
42

53
`рд╕рд╛рдореЗрд▓` рд╡рд┐рдзрд┐, рдПрдХ рд╕рд░рдгреА рдПрдХ рд╕реНрдЯреНрд░рд┐рдВрдЧ рдорд╛ рдмрд╛рд░реА рдмрдирд╛рдЙрдБрдЫ рд░ рдпреЛ рд╕рдмреИ рдПрдХ рд╕рд╛рде рдЬреЛрдбрд┐рдиреНрдЫред рдпрд╕рд▓реЗ рдореВрд▓ рд╕рд░рдгреА рдкрд░рд┐рд╡рд░реНрддрди рдЧрд░реНрджреИрди ред рдпрд╣рд╛рдБ 'рд╕рд╛рдореЗрд▓' рдкреНрд░рдпреЛрдЧ рдЧрд░реНрдирдХрд╛ рд▓рд╛рдЧрд┐ рд╡рд╛рдХреНрдпрд░рдЪрдирд╛ рдЫ:
64

75
```c
86
array.join([separator]);
97
```
108

11-
The `separator` argument is optional and specifies the character to be used to separate the elements in the resulting string. If omitted, the array elements are separated with a comma (`,`).
12-
139
`рд╡рд┐рднрд╛рдЬрдХ (separator)` рддрд░реНрдХ рд╡реИрдХрд▓реНрдкрд┐рдХ рдЫ рд░ рдкрд░рд┐рдгрд╛рдореА рд╕реНрдЯреНрд░рд┐рдЩрдорд╛ рддрддреНрд╡рд╣рд░реВ рдЕрд▓рдЧ рдЧрд░реНрди рдкреНрд░рдпреЛрдЧ рдЧрд░рд┐рдиреЗ рдХреНрдпрд╛рд░реЗрдХреНрдЯрд░ рдирд┐рд░реНрджрд┐рд╖реНрдЯ рдЧрд░реНрджрдЫред рдпрджрд┐ рдЫреЛрдбрд┐рдпреЛ рднрдиреЗ, рд╕рд░рдгреА рддрддреНрд╡рд╣рд░реВ рдЕрд▓реНрдкрд╡рд┐рд░рд╛рдо `(',')` рд╕рдБрдЧ рдЕрд▓рдЧ рд╣реБрдиреНрдЫрдиреНред
1410

15-
For example:
16-
1711
рдЙрджрд╛рд╣рд░рдгрдХреЛ рд▓рд╛рдЧреА:
1812

1913
```javascript
@@ -26,14 +20,9 @@ console.log(array.join(" "));
2620

2721
{% hint style="warning" %}
2822

29-
30-
Any separator can be specified but the default one is a comma `(,)`.
31-
3223
рдХреБрдиреИ рдкрдирд┐ рд╡рд┐рднрд╛рдЬрдХ рдирд┐рд░реНрджрд┐рд╖реНрдЯ рдЧрд░реНрди рд╕рдХрд┐рдиреНрдЫ рддрд░ рдкреВрд░реНрд╡рдирд┐рд░реНрдзрд╛рд░рд┐рдд рдЕрд▓реНрдкрд╡рд┐рд░рд╛рдо `(,)` рд╣реЛред
3324
{% endhint %}
3425

35-
In the above example, a space is used as a separator. You can also use `join` to convert an array-like object (such as an arguments object or a NodeList object) to a string by first converting it to an array using the `Array.prototype.slice()` method:
36-
3726
рдорд╛рдерд┐рдХреЛ рдЙрджрд╛рд╣рд░рдгрдорд╛, рдПрдХ рд╕реНрдерд╛рди рд╡рд┐рднрд╛рдЬрдХрдХреЛ рд░реВрдкрдорд╛ рдкреНрд░рдпреЛрдЧ рдЧрд░рд┐рдиреНрдЫред рддрдкрд╛рдИрдБрд▓реЗ рдПрд░реЗ рдЬрд╕реНрддреЛ рд╡рд╕реНрддреБ (рдЬрд╕реНрддреИ рддрд░реНрдХ рд╡рд╕реНрддреБ рд╡рд╛ рдиреЛрдбрд╕реВрдЪреА рд╡рд╕реНрддреБ) рд▓рд╛рдИ рд╕реНрдЯреНрд░рд┐рдЩрдорд╛ рд░реВрдкрд╛рдиреНрддрд░рдг рдЧрд░реНрди `рд╕рд╛рдореЗрд▓` рдкрдирд┐ рдкреНрд░рдпреЛрдЧ рдЧрд░реНрди рд╕рдХреНрдиреБрд╣реБрдиреНрдЫ, рдпрд╕рд▓рд╛рдИ `Array.prototype.slice()` рд╡рд┐рдзрд┐ рдкреНрд░рдпреЛрдЧ рдЧрд░реЗрд░ рд╕рд░рдгреАрдорд╛ рд░реВрдкрд╛рдиреНрддрд░рдг рдЧрд░реЗрд░:
3827

3928
```javascript

тАОne/arrays/length.mdтАО

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# Length (рд▓рдореНрдмрд╛рдЗ)
1+
# рд▓рдореНрдмрд╛рдЗ
22

3-
Arrays have a property called `length`, and it's pretty much exactly as it sounds, it's the length of the array.
4-
5-
рдПрд░реЗрд╕рдБрдЧ `рд▓рдореНрдмрд╛` рднрдирд┐рдиреЗ рдЧреБрдг рдЫ, рд░ рдпреЛ рдПрд░реЗрдХреЛ рд▓рдореНрдмрд╛рдЗ рд╣реЛред
3+
рдПрд░реЗрд╕рдБрдЧ `рд▓рдореНрдмрд╛рдЗ (length)` рднрдирд┐рдиреЗ рдЧреБрдг рдЫ, рд░ рдпреЛ рдПрд░реЗрдХреЛ рд▓рдореНрдмрд╛рдЗ рд╣реЛред
64

75
```javascript
86
let array = [1, 2, 3];
@@ -12,8 +10,6 @@ let l = array.length;
1210
// Result: l = 3
1311
```
1412

15-
The length property also sets the number of elements in an array. For example.
16-
1713
рд▓рдореНрдмрд╛рдЗ рдЧреБрдгрд▓реЗ рдПрд░реЗрдорд╛ рддрддреНрд╡рд╣рд░реВрдХреЛ рд╕рдВрдЦреНрдпрд╛ рдкрдирд┐ рд╕реЗрдЯ рдЧрд░реНрджрдЫред рдЙрджрд╛рд╣рд░рдгрдХрд╛ рд▓рд╛рдЧрд┐:
1814

1915
```javascript
@@ -24,17 +20,13 @@ console.log(fruits);
2420
// Result: ['Banana', 'Orange']
2521
```
2622

27-
You can also use the `length` property to get the last element of an array by using it as an index. For example:
28-
2923
рддрдкрд╛рдИрдБрд▓реЗ рдЕрдиреБрдХреНрд░рдордгрд┐рдХрд╛рдХреЛ рд░реВрдкрдорд╛ рдкреНрд░рдпреЛрдЧ рдЧрд░реЗрд░ рд╕рд░рдгреАрдХреЛ рдЕрдиреНрддрд┐рдо рддрддреНрд╡ рдкреНрд░рд╛рдкреНрдд рдЧрд░реНрди `рд▓рдореНрдмрд╛рдЗ` рдЧреБрдг рдкрдирд┐ рдкреНрд░рдпреЛрдЧ рдЧрд░реНрди рд╕рдХреНрдиреБрд╣реБрдиреНрдЫред рдЙрджрд╛рд╣рд░рдгрдХрд╛ рд▓рд╛рдЧрд┐:
3024

3125
```c
3226
console.log(fruits[fruits.length - 1]); // Result: Orange
3327
```
3428

35-
You can also use the `length` property to add elements to the end of an array. For example:
36-
37-
рд╕рд░рдгреАрдХреЛ рдЕрдиреНрддреНрдпрдорд╛ рддрддреНрд╡рд╣рд░реВ рдердкреНрди рддрдкрд╛рдИрдБрд▓реЗ `рд▓рдореНрдмрд╛рдЗ` рдЧреБрдг рдкрдирд┐ рдкреНрд░рдпреЛрдЧ рдЧрд░реНрди рд╕рдХреНрдиреБрд╣реБрдиреНрдЫ ред рдЙрджрд╛рд╣рд░рдгрдХрд╛ рд▓рд╛рдЧрд┐:
29+
рд╕рд░рдгреА ( рдПрд░реЗ) рдХреЛ рдЕрдиреНрддреНрдпрдорд╛ рддрддреНрд╡рд╣рд░реВ рдердкреНрди рддрдкрд╛рдИрдБрд▓реЗ `рд▓рдореНрдмрд╛рдЗ` рдЧреБрдг рдкрдирд┐ рдкреНрд░рдпреЛрдЧ рдЧрд░реНрди рд╕рдХреНрдиреБрд╣реБрдиреНрдЫ ред рдЙрджрд╛рд╣рд░рдгрдХрд╛ рд▓рд╛рдЧрд┐:
3830

3931
```c
4032
fruits[fruits.length] = "Pineapple";
@@ -43,14 +35,9 @@ console.log(fruits); // Result: ['Banana', 'Orange', 'Pineapple']
4335

4436
{% hint style="info" %}
4537

46-
47-
The `length` property is automatically updated when elements are added or removed from the array.
48-
4938
рд╕рд░рдгреАрдмрд╛рдЯ рддрддреНрд╡рд╣рд░реВ рдердкреНрджрд╛ рд╡рд╛ рд╣рдЯрд╛рдЙрдБрджрд╛ `рд▓рдореНрдмрд╛рдЗ` рдЧреБрдг рд╕реНрд╡рдЪрд╛рд▓рд┐рдд рд░реВрдкрдорд╛ рдЕрджреНрдпрд╛рд╡рдзрд┐рдХ рд╣реБрдиреНрдЫред
5039
{% endhint %}
5140

52-
It's also worth noting that the `length` property is not a method, so you don't need to use parentheses when accessing it. It's simply a property of the array object that you can access like any other object property.
53-
5441
рдпреЛ рдкрдирд┐ рдЯрд┐рдкреНрдкрдг рдпреЛрдЧреНрдп рдЫ рдХрд┐ `рд▓рдореНрдмрд╛рдЗ` рдЧреБрдг рдПрдХ рд╡рд┐рдзрд┐ рд╣реЛрдЗрди, рддреНрдпрд╕реИрд▓реЗ рддрдкрд╛рдИрдВ рдпрд╕рд▓рд╛рдИ рдкрд╣реБрдБрдЪ рдЧрд░реНрджрд╛ рдХреЛрд╖реНрдардХ рдкреНрд░рдпреЛрдЧ рдЧрд░реНрди рдЖрд╡рд╢реНрдпрдХ рдЫреИрдиред
5542

5643

0 commit comments

Comments
┬а(0)