feat(m4): solution exe 013#2526
Conversation
| const redacted = 'redacted.txt' | ||
|
|
||
| //function to read the content of the story | ||
| const readStory = story => { |
There was a problem hiding this comment.
story -> global scope ;-)
const readStory = () => { .....
| } | ||
|
|
||
| // function to read the content of sesitive words | ||
| const readSensitive = sensitive => { |
There was a problem hiding this comment.
sensitive -> global scope ;-)
const readSensitive = () => { .....
There was a problem hiding this comment.
why? it's just in this exercise, because I don't call the fucntion?
| return text | ||
| } | ||
|
|
||
| Promise.all([readStory(story), readSensitive(sensitive)]) |
There was a problem hiding this comment.
Promise.all( [ readStory(), readSensitive() ] )
| }) | ||
| .catch((error) => { | ||
| if (error.code === 'ENOENT') { | ||
| console.error(`${redacted} file does not exist`) |
There was a problem hiding this comment.
Try renaming sensitive words -> sensitive_words.
Check if the problem prints correctly.
There was a problem hiding this comment.
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()
There was a problem hiding this comment.
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
No description provided.