Skip to content

Commit 9d51da5

Browse files
committed
Fix typo on day 18 explanation
1 parent d419c1f commit 9d51da5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/day18.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@
3434
* case), starts empty, and during the iteration I'll be filling it. If I get to al element that doesn't appears on the
3535
* map, I added with an starting value of 1 (first occurrence). Otherwise I increments its existing value.
3636
* - The mapping works like this:
37-
* 1. I always return first the actual item. Then I check if the iten exists on the map. If it does exist I just
37+
* 1. I always return first the actual item. Then I check if the item exists on the map. If it does exist I just
3838
* have to return the value and increment it. Otherwise, I use the same trick I used on exercise 10.
3939
* 2. The trick consists on that I don't wanna to return nothing, as the first occurrences of items shall not have
4040
* the counter on their string. But I need to modify its value. By doing this[file] = 1 the returning value
4141
* would be '1'. I don't want this. Because of this I put this sentence in an inner void function so the
4242
* returning value would be 'undefined'. Why would I do that? I don't want 'undefined' either. Because by
43-
* getting and undefined I could use the OR logical operator to return and empty string. By doing this I
44-
* can modify its value and return nothing.
43+
* getting and undefined I could use the nullish coalescing operator ?? (logical OR operator || would work
44+
* too) to return and empty string. By doing this I can modify its value and return nothing.
4545
*/
4646
export default function fixFiles(files) {
4747
return files.map(function (file) {

0 commit comments

Comments
 (0)