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 " " 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 " " (which in your IDE I think works by clicking on "CRLF" in the status bar), or perhaps the better solution: using .split(/ ? /) 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 parseInt(`${numbersInString[0]}${numbersInString[numbersInString.length - 1]}`), note that I used backticks (`) and not an apostrophe!
Hey, thanks for the kind words and your tips! You're absolutely right about linesplitting, I'll have to keep an eye on it in the future ;) Hopefully my English will improve, practice makes perfect! For readability and of course the fact that I don't have to insert an additional empty string at 11:15, template literals as you suggested are an elegant solution. I wish you happy holidays and of course lots of fun with the last AoC days!
Hey, thanks for your comment! The type updates you see are an IntelliJ feature. You can switch them on or off in the IntelliJ IDE under Settings > Editor > Inlay Hints > Types > Typescript. The typing works quite well in most cases, but it is not binding and can only be seen visually. To be type-safe, you still have to write it out! :)
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 "
" 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 "
" (which in your IDE I think works by clicking on "CRLF" in the status bar), or perhaps the better solution: using .split(/
?
/) 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 parseInt(`${numbersInString[0]}${numbersInString[numbersInString.length - 1]}`), note that I used backticks (`) and not an apostrophe!
Hey, thanks for the kind words and your tips! You're absolutely right about linesplitting, I'll have to keep an eye on it in the future ;)
Hopefully my English will improve, practice makes perfect! For readability and of course the fact that I don't have to insert an additional empty string at 11:15, template literals as you suggested are an elegant solution.
I wish you happy holidays and of course lots of fun with the last AoC days!
@@diehypotenuse4908 Happy holidays to you too! :D
Thanks for the video. How are your types visually updating in realtime? 0:42
Hey, thanks for your comment!
The type updates you see are an IntelliJ feature. You can switch them on or off in the IntelliJ IDE under Settings > Editor > Inlay Hints > Types > Typescript.
The typing works quite well in most cases, but it is not binding and can only be seen visually. To be type-safe, you still have to write it out! :)
Just use regex instead of the loop check