Skip to content

Conversation

drbabol
Copy link

@drbabol drbabol commented Dec 27, 2022

No description provided.

const redacted = 'redacted.txt'

//function to read the content of the story
const readStory = story => {

Choose a reason for hiding this comment

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

story -> global scope ;-)
const readStory = () => { .....

}

// function to read the content of sesitive words
const readSensitive = sensitive => {

Choose a reason for hiding this comment

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

sensitive -> global scope ;-)
const readSensitive = () => { .....

Copy link
Author

@drbabol drbabol Jan 23, 2023

Choose a reason for hiding this comment

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

why? it's just in this exercise, because I don't call the fucntion?

return text
}

Promise.all([readStory(story), readSensitive(sensitive)])

Choose a reason for hiding this comment

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

Promise.all( [ readStory(), readSensitive() ] )

})
.catch((error) => {
if (error.code === 'ENOENT') {
console.error(`${redacted} file does not exist`)

Choose a reason for hiding this comment

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

Try renaming sensitive words -> sensitive_words.
Check if the problem prints correctly.

Copy link
Author

Choose a reason for hiding this comment

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

I see the problem, I will try to fix it by adding a function to read the redacted file and add it to the Promise.all()

Copy link
Author

Choose a reason for hiding this comment

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

Maybe I can optimize the code buy writing only one function to read files and called it 3 times in the Promise.all...
Working in Progress

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