Skip to content

01 hw already to check#2

Open
bogdanAndrushchenko wants to merge 1 commit intomainfrom
01_node_js_basic
Open

01 hw already to check#2
bogdanAndrushchenko wants to merge 1 commit intomainfrom
01_node_js_basic

Conversation

@bogdanAndrushchenko
Copy link
Copy Markdown
Owner

No description provided.

Comment thread contacts.js

const listContacts = async () => {
try {
const res = await fs.readFile(contactsPath);
Copy link
Copy Markdown
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.

Comment thread contacts.js
if (findContact === undefined) {
console.log(`Your id:${contactId} not found!`);
}
console.log(findContact);
Copy link
Copy Markdown
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.

2 participants