Skip to content

10.07.18 first push#16

Open
GeorgeTsendra wants to merge 2 commits intomasterfrom
callBook
Open

10.07.18 first push#16
GeorgeTsendra wants to merge 2 commits intomasterfrom
callBook

Conversation

@GeorgeTsendra
Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread Call Book/js.js Outdated
//формируем ID по длине массива + 1
let correctId = this.dataBase.length+1;

this.dataBase.push({id:correctId,name:name,thername:thername,numb:`(${firstThreeNumb})${secondTwoNumb}-${therdTwoNumb}-${fourthThreeNumb}`})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут оччень длинная строка, предлагаю сделать отдельный конструктор для создания пользователя

Comment thread Call Book/js.js Outdated
PhoneApp.prototype.usersRemoving = function(username) {
this.dataBase.forEach((value, index, arr)=> {
if (value.name === username) {
delete this.dataBase[index];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

будет дыра в массиве,

использования метода .filter - тут подойдет лучше

Comment thread Call Book/js.js

PhoneApp.prototype.searchUsers = function(username) {
let allUsers = [];
this.dataBase.forEach((value, index, arr)=> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тоже подойдет лучше метод filter

Comment thread Call Book/js.js Outdated
this.dataBase.forEach((value, index, arr)=> {
let correctId = index + 1;
if (value.id == userId) {
this.dataBase[index] = {id:correctId,name:name,thername:thername,numb:`(${firstThreeNumb})${secondTwoNumb}-${therdTwoNumb}-${fourthThreeNumb}`};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{id:correctId,name:name,thername:thername,numb:`(${firstThreeNumb})${secondTwoNumb}-${therdTwoNumb}-${fourthThreeNumb}`};

это очень длинная строка, легче это называть в духе "makeUser" или что то такое

она даже не очень помещается в экран

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants