-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added task Трансформировать в массив имён
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Трансформировать в массив имён | ||
|
||
У вас есть массив объектов `user`, и в каждом из них есть `user.name`. Напишите функцию `namify`, которая преобразует их в массив имён. | ||
|
||
Например: | ||
|
||
```js | ||
let vasya = { name: 'Вася', age: 25 }; | ||
let petya = { name: 'Петя', age: 30 }; | ||
let masha = { name: 'Маша', age: 28 }; | ||
|
||
let users = [ vasya, petya, masha ]; | ||
|
||
function namify(users) { | ||
// ваш код | ||
} | ||
|
||
let names = namify(users); // ['Вася', 'Петя', 'Маша'] | ||
``` |
This file contains 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
function namify(users) { | ||
// ваш код... | ||
} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
describe('3-module-1-task', () => { | ||
it('должна преобразовать users в массив имён', () => { | ||
let vasya = { name: 'Вася', age: 25 }; | ||
let petya = { name: 'Петя', age: 30 }; | ||
let masha = { name: 'Маша', age: 28 }; | ||
|
||
let users = [vasya, petya, masha]; | ||
let names = ['Вася', 'Петя', 'Маша']; | ||
|
||
expect(namify(users)).toEqual(names); | ||
}); | ||
}); |