Skip to content

Conversation

@GeorgeTsendra
Copy link
Collaborator

No description provided.

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
Member

Choose a reason for hiding this comment

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

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

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
Member

Choose a reason for hiding this comment

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

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

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


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

Choose a reason for hiding this comment

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

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

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
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