Code Review with a Jr JavaScript Developer - Here's What I Found!

preview_player
Показать описание
I made these 5 suggestions throughout a 2 hour code review with a junior JavaScript developer.

**Newsletter**

**DISCORD**

**QUESTIONS ABOUT MY SETUP**
Рекомендации по теме
Комментарии
Автор

I like to decontstruct variables but you could argue against. If you dont deconstruct you automatically get a good descriptive name: subscriber.email says a lot about which email you refer to.

jesper.ordrup
Автор

Learned something new regarding err handling,
throwing err as obj key and use it for checking a condition.
Thank you.

sujoykrhaldar
Автор

Loved this! Especially the view of typescript at the end. Im just starting a new role in a few weeks and I'm always looking to improve my code so that reviews are seamless!

benpluim
Автор

1. Object Properties 0:27
Never check if an object has a property by accessing its value:

If it doesnt have it, the code wont run ; GOOD
if it has it and is nullable (undefined / null), the code wont run ; BAD ; sometimes nullable values are expected and this is true especially when fetching data

use hasOwnProperty method on the object instance instead or iterate over the project keys to find the match, then code accordingly.
personally, I prefer a custom function, hasOwnProperties(), that takes in one value, primitive or array, then checks for matches in object props for every value.

2. Using shorthand notation 1:57

I disagree with that since if the code will ever require refactoring, the changes will have to cascade all they way, otherwise the code will not work properly.
I personally write the longhand notation so that code style is consistent and the small changes wont require refactoring the entire codebase

SeRoShadow
Автор

The joke is the two hardest things in programming is cache and naming things.

gosnooky
Автор

Curious, with autocomplete being a thing, isn’t it better to be explicit with subscriber.email vs simply email. Keeps it clear where that variable comes from?

RobertMcGovernTarasis
Автор

Thanks for the video, very useful. What vs code theme is this?

gregmunro
Автор

Destructuring has its downsides, if email is undefined, everything is going to break down.

Doing a safety check first is always better, even if it requires writing a few extra words

nidinpereira
Автор

There are 2 hard problems in programming: cache invalidation, naming things, and off-by-1 errors.

hunterbertoson
Автор

Bytescale upload Image tutorial ? no any video on youtube

cyphermediaschool
visit shbcf.ru