Skip to content

Conversation

@bogdanAndrushchenko
Copy link
Owner

No description provided.


const listContacts = async () => {
try {
const res = await fs.readFile(contactsPath);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Хорошой практикой есть разделение функционала. Сделай так что бы эта функция возвращала данные, таким образом ты сможешь их использовать в коде ниже, например в функции (getContactById). Выводить их в консоль будет в конструкции switch case в index.js.

if (findContact === undefined) {
console.log(`Your id:${contactId} not found!`);
}
console.log(findContact);
Copy link
Collaborator

Choose a reason for hiding this comment

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

тоже что и в listContacts. Возвращай значения з функции. Выводи в консоль в индексе

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.

3 participants