Advent of Code 2023 - Day 1 in Typescript (solution explained)

preview_player
Показать описание
Hey, this is Advent of Code 2023!

Have fun and a happy Advent season!
Рекомендации по теме
Комментарии
Автор

Great video! I also love seeing all the approaches of handling the words in part 2, your approach looks pretty quick!

A few points I'd like to address though:
- Splitting with "\r\n" only makes sense if the file is encoded with that new line sequence (which as far as I know is just Windows). A recommendation of mine would be to either switch to "\n" (which in your IDE I think works by clicking on "CRLF" in the status bar), or perhaps the better solution: using .split(/\r?\n/) which will support both both :)

- When talking about the letter "i", pronouncing it as [i] (also known as the German "i") can easily be mistaken with the letter "e" in English ;) Your English seems really good though!

- The magic (even though obvious in this code) numbers 3 and 5 could be stored in constants to give them names for descriptions, which might be overkill for Advent of Code, but I just felt like throwing that in the room :)

- About 11:15 adding numbers, I'd highly recommend writing - 1]}`), note that I used backticks (`) and not an apostrophe!

EMEKC
Автор

Just use regex instead of the loop check

limitlesskode
Автор

Thanks for the video. How are your types visually updating in realtime? 0:42

JaredFL