-
Notifications
You must be signed in to change notification settings - Fork 179
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Array methods #192
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
a11e2a3
Objects
Regnised d073b92
Merge branch 'javascript-tutorial:master' into master
Regnised 6f63dff
Update 1-js/04-object-basics/01-object/2-hello-object/task.md
Regnised 690516f
Update 1-js/04-object-basics/01-object/3-is-empty/task.md
Regnised d1d20f9
Update 1-js/04-object-basics/01-object/8-multiply-numeric/_js.view/te…
Regnised 126b55b
Update 1-js/04-object-basics/01-object/8-multiply-numeric/_js.view/te…
Regnised 1808c2f
Update 1-js/04-object-basics/01-object/article.md
Regnised b7f4746
Update 1-js/04-object-basics/01-object/article.md
Regnised c31ff51
Update 1-js/04-object-basics/01-object/2-hello-object/task.md
tarasyyyk 68d53eb
Update 1-js/04-object-basics/01-object/2-hello-object/task.md
tarasyyyk 019602e
Update 1-js/04-object-basics/01-object/2-hello-object/task.md
tarasyyyk 550b1fb
Objects
Regnised 787568b
Merge branch 'master' of github.com:Regnised/uk.javascript.info
Regnised 82f0f9a
Merge branch 'javascript-tutorial:master' into master
Regnised cbda1c0
Update 1-js/05-data-types/05-array-methods/1-camelcase/task.md
tarasyyyk 3f73a4b
Update 1-js/05-data-types/05-array-methods/10-average-age/task.md
Regnised 007d5ac
Update 1-js/05-data-types/05-array-methods/11-array-unique/solution.md
Regnised 0a58cb5
Update 1-js/05-data-types/05-array-methods/12-reduce-object/task.md
Regnised 15efbc0
Update 1-js/05-data-types/05-array-methods/9-shuffle/task.md
Regnised 7758975
Update 1-js/05-data-types/05-array-methods/9-shuffle/solution.md
Regnised ca0c3b0
Update 1-js/05-data-types/05-array-methods/2-filter-range/task.md
Regnised 86fccb4
Update 1-js/05-data-types/05-array-methods/2-filter-range/task.md
Regnised 1ea7283
Update 1-js/05-data-types/05-array-methods/3-filter-range-in-place/ta…
Regnised 676d942
Update 1-js/05-data-types/05-array-methods/7-map-objects/task.md
Regnised eff8fea
Add translate
Regnised 5cb6b18
Merge branch 'master' of github.com:Regnised/uk.javascript.info
Regnised 4a1c393
Merge branch 'javascript-tutorial:master' into master
Regnised c987f1d
Update 1-js/05-data-types/05-array-methods/9-shuffle/solution.md
tarasyyyk b5a26f7
Update 1-js/05-data-types/05-array-methods/9-shuffle/solution.md
tarasyyyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
8 changes: 4 additions & 4 deletions
8
1-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('-') // splits 'my-long-word' into array ['my', 'long', 'word'] | ||
.split('-') // розбиваємо 'my-long-word' на масив елементів ['my', 'long', 'word'] | ||
.map( | ||
// capitalizes first letters of all array items except the first one | ||
// converts ['my', 'long', 'word'] into ['my', 'Long', 'Word'] | ||
// робимо першу літеру велику для всіх елементів масиву, крім першого | ||
// конвертуємо ['my', 'long', 'word'] в ['my', 'Long', 'Word'] | ||
(word, index) => index == 0 ? word : word[0].toUpperCase() + word.slice(1) | ||
) | ||
.join(''); // joins ['my', 'Long', 'Word'] into 'myLongWord' | ||
.join(''); // зʼєднуємо ['my', 'Long', 'Word'] в 'myLongWord' | ||
} |
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
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
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
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
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
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 deletion
2
1-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) { | ||
// added brackets around the expression for better readability | ||
// навколо виразу додано дужки для кращої читабельності | ||
return arr.filter(item => (a <= item && item <= b)); | ||
} |
6 changes: 3 additions & 3 deletions
6
1-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) { | ||
// added brackets around the expression for better readability | ||
// навколо виразу додано дужки для кращої читабельності | ||
return arr.filter(item => (a <= item && item <= b)); | ||
} | ||
|
||
let arr = [5, 3, 8, 1]; | ||
|
||
let filtered = filterRange(arr, 1, 4); | ||
|
||
alert( filtered ); // 3,1 (matching values) | ||
alert( filtered ); // 3,1 (відфільтровані значення) | ||
|
||
alert( arr ); // 5,3,8,1 (not modified) | ||
alert( arr ); // 5,3,8,1 (не змінюється) | ||
``` |
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
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
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
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 deletion
2
1-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
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 deletions
10
1-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 | ||
|
||
let john = { name: "John", age: 25 }; | ||
let pete = { name: "Pete", age: 30 }; | ||
let mary = { name: "Mary", age: 28 }; | ||
let ivan = { name: "Іван", age: 25 }; | ||
let petro = { name: "Петро", age: 30 }; | ||
let mariya = { name: "Марія", age: 28 }; | ||
|
||
let users = [ john, pete, mary ]; | ||
let users = [ ivan, petro, mariya ]; | ||
|
||
let names = users.map(item => item.name); | ||
|
||
alert( names ); // John, Pete, Mary | ||
alert( names ); // Іван, Петро, Марія | ||
``` | ||
|
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 deletions
4
1-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 @@ | ||
|
||
- Please note how methods are stored. They are simply added to `this.methods` property. | ||
- All tests and numeric conversions are done in the `calculate` method. In future it may be extended to support more complex expressions. | ||
- Зверніть увагу, як зберігаються методи. Вони просто додаються до внутрішнього обʼєкта (`this.methods`). | ||
- Всі тести та числові перетворення виконуються в методі `calculate`. У майбутньому він може бути розширений для підтримки складніших виразів. |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.