- Notifications
You must be signed in to change notification settings - Fork179
Array methods#192
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Array methods#192
Changes fromall commits
Commits
Show all changes
29 commits Select commitHold shift + click to select a range
a11e2a3
Objects
Regnisedd073b92
Merge branch 'javascript-tutorial:master' into master
Regnised6f63dff
Update 1-js/04-object-basics/01-object/2-hello-object/task.md
Regnised690516f
Update 1-js/04-object-basics/01-object/3-is-empty/task.md
Regnisedd1d20f9
Update 1-js/04-object-basics/01-object/8-multiply-numeric/_js.view/te…
Regnised126b55b
Update 1-js/04-object-basics/01-object/8-multiply-numeric/_js.view/te…
Regnised1808c2f
Update 1-js/04-object-basics/01-object/article.md
Regnisedb7f4746
Update 1-js/04-object-basics/01-object/article.md
Regnisedc31ff51
Update 1-js/04-object-basics/01-object/2-hello-object/task.md
tarasyyyk68d53eb
Update 1-js/04-object-basics/01-object/2-hello-object/task.md
tarasyyyk019602e
Update 1-js/04-object-basics/01-object/2-hello-object/task.md
tarasyyyk550b1fb
Objects
Regnised787568b
Merge branch 'master' of github.com:Regnised/uk.javascript.info
Regnised82f0f9a
Merge branch 'javascript-tutorial:master' into master
Regnisedcbda1c0
Update 1-js/05-data-types/05-array-methods/1-camelcase/task.md
tarasyyyk3f73a4b
Update 1-js/05-data-types/05-array-methods/10-average-age/task.md
Regnised007d5ac
Update 1-js/05-data-types/05-array-methods/11-array-unique/solution.md
Regnised0a58cb5
Update 1-js/05-data-types/05-array-methods/12-reduce-object/task.md
Regnised15efbc0
Update 1-js/05-data-types/05-array-methods/9-shuffle/task.md
Regnised7758975
Update 1-js/05-data-types/05-array-methods/9-shuffle/solution.md
Regnisedca0c3b0
Update 1-js/05-data-types/05-array-methods/2-filter-range/task.md
Regnised86fccb4
Update 1-js/05-data-types/05-array-methods/2-filter-range/task.md
Regnised1ea7283
Update 1-js/05-data-types/05-array-methods/3-filter-range-in-place/ta…
Regnised676d942
Update 1-js/05-data-types/05-array-methods/7-map-objects/task.md
Regnisedeff8fea
Add translate
Regnised5cb6b18
Merge branch 'master' of github.com:Regnised/uk.javascript.info
Regnised4a1c393
Merge branch 'javascript-tutorial:master' into master
Regnisedc987f1d
Update 1-js/05-data-types/05-array-methods/9-shuffle/solution.md
tarasyyykb5a26f7
Update 1-js/05-data-types/05-array-methods/9-shuffle/solution.md
tarasyyykFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
8 changes: 4 additions & 4 deletions1-js/05-data-types/05-array-methods/1-camelcase/_js.view/solution.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
function camelize(str) { | ||
return str | ||
.split('-') //розбиваємо 'my-long-word'на масив елементів ['my', 'long', 'word'] | ||
.map( | ||
//робимо першу літеру велику для всіх елементів масиву, крім першого | ||
//конвертуємо ['my', 'long', 'word']в ['my', 'Long', 'Word'] | ||
(word, index) => index == 0 ? word : word[0].toUpperCase() + word.slice(1) | ||
) | ||
.join(''); //зʼєднуємо ['my', 'Long', 'Word']в 'myLongWord' | ||
} |
10 changes: 5 additions & 5 deletions1-js/05-data-types/05-array-methods/1-camelcase/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions1-js/05-data-types/05-array-methods/10-average-age/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions1-js/05-data-types/05-array-methods/10-average-age/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
28 changes: 14 additions & 14 deletions1-js/05-data-types/05-array-methods/11-array-unique/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
16 changes: 8 additions & 8 deletions1-js/05-data-types/05-array-methods/11-array-unique/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
28 changes: 14 additions & 14 deletions1-js/05-data-types/05-array-methods/12-reduce-object/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2,36 +2,36 @@ importance: 4 | ||
--- | ||
#Створення об’єкта з ключем з масиву | ||
Припустимо, ми отримали масив користувачів у вигляді`{id:..., name:..., age:...}`. | ||
Створіть функцію`groupById(arr)`, яка створює з масиву об’єкт із ключом `id`та елементами масиву як значеннями. | ||
Наприклад: | ||
```js | ||
let users = [ | ||
{id: 'іван', name: "Іван Іванко", age: 20}, | ||
{id: 'ганна', name: "Ганна Іванко", age: 24}, | ||
{id: 'петро', name: "Петро Петренко", age: 31}, | ||
]; | ||
let usersById = groupById(users); | ||
Regnised marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
/* | ||
//після виклику функції ви повинні отримати: | ||
usersById = { | ||
іван: {id: 'іван', name: "Іван Іванко", age: 20}, | ||
ганна: {id: 'ганна', name: "Ганна Іванко", age: 24}, | ||
петро: {id: 'петро', name: "Петро Петренко", age: 31}, | ||
} | ||
*/ | ||
``` | ||
Така функція дійсно зручна при роботі з даними сервера. | ||
У цьому завданні ми вважаємо, що `id`унікальний. Не може бути двох елементів масиву з однаковими `id`. | ||
Будь ласка, використовуйте метод масиву`.reduce` у рішенні. |
2 changes: 1 addition & 1 deletion1-js/05-data-types/05-array-methods/2-filter-range/_js.view/solution.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
function filterRange(arr, a, b) { | ||
//навколо виразу додано дужки для кращої читабельності | ||
return arr.filter(item => (a <= item && item <= b)); | ||
} |
6 changes: 3 additions & 3 deletions1-js/05-data-types/05-array-methods/2-filter-range/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
```js run demo | ||
function filterRange(arr, a, b) { | ||
//навколо виразу додано дужки для кращої читабельності | ||
return arr.filter(item => (a <= item && item <= b)); | ||
} | ||
let arr = [5, 3, 8, 1]; | ||
let filtered = filterRange(arr, 1, 4); | ||
alert( filtered ); // 3,1 (відфільтровані значення) | ||
alert( arr ); // 5,3,8,1 (не змінюється) | ||
``` |
12 changes: 6 additions & 6 deletions1-js/05-data-types/05-array-methods/2-filter-range/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions1-js/05-data-types/05-array-methods/3-filter-range-in-place/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions1-js/05-data-types/05-array-methods/3-filter-range-in-place/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions1-js/05-data-types/05-array-methods/4-sort-back/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion1-js/05-data-types/05-array-methods/5-copy-sort-array/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Для копіювання масиву використовуємо`slice()`і тут же -- сортування: | ||
```js run | ||
function copySorted(arr) { | ||
8 changes: 4 additions & 4 deletions1-js/05-data-types/05-array-methods/5-copy-sort-array/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions1-js/05-data-types/05-array-methods/6-array-get-names/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
```js run | ||
letivan = { name: "Іван", age: 25 }; | ||
letpetro = { name: "Петро", age: 30 }; | ||
letmariya = { name: "Марія", age: 28 }; | ||
let users = [ivan, petro, mariya ]; | ||
let names = users.map(item => item.name); | ||
alert( names ); //Іван, Петро, Марія | ||
``` | ||
18 changes: 9 additions & 9 deletions1-js/05-data-types/05-array-methods/6-array-get-names/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions1-js/05-data-types/05-array-methods/6-calculator-extendable/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
-Зверніть увагу, як зберігаються методи. Вони просто додаються до внутрішнього обʼєкта (`this.methods`). | ||
-Всі тести та числові перетворення виконуються в методі`calculate`. У майбутньому він може бути розширений для підтримки складніших виразів. |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.