Conversation
Ami777
left a comment
There was a problem hiding this comment.
Dobre, eleganckie rozwiązanie.
| fs.readdir(path, (err, files) => { | ||
| if (!err) { | ||
| files.forEach(file => { | ||
| readContent(path + file); |
There was a problem hiding this comment.
Super, tak jest dużo czytalniej.
| const filePath = process.argv[2]; | ||
| const outputPath = './data/zadanieDnia/output.txt' | ||
|
|
||
| const setCase = (letter, index) => { |
There was a problem hiding this comment.
Bardzo fajny podział na osobne funkcje!
There was a problem hiding this comment.
No właśnie mam wrażenie ze setCase jest już niepotrzebny przy zoptymalizowaniu kodu do jednego wiersza.
Bardziej jestem niezadowolony z pętli for, która próbowałem zastąpić: text.split().forEach((letter, index) => ...itd, ale nie wiem czemu otrzymywałem pod letter cały tekst. Czy split(’’) zadziała?
There was a problem hiding this comment.
Tak, split(''), bo "If separator is omitted, the array returned contains one element consisting of the entire string. If separator is an empty string, str is converted to an array of characters." (https://developer.mozilla.org/pl/docs/Web/JavaScript/Referencje/Obiekty/String/split)
No description provided.