Great article! Coming from a Rails background, I've been really missing the .try method in JS. Happy to see it's finally landed.
.try
That said, it's difficult to discuss optional chaining without talking about the law of demeter, and exactly how much chaining is the right amount.
It's a powerful tool, but it can definitely become overused and cause your application to be brittle!
Ruby has optional chaining too, with &., haven't used try in a long time 😊
&.
try
Take it for a spin!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great article! Coming from a Rails background, I've been really missing the
.try
method in JS. Happy to see it's finally landed.That said, it's difficult to discuss optional chaining without talking about the law of demeter, and exactly how much chaining is the right amount.
It's a powerful tool, but it can definitely become overused and cause your application to be brittle!
Ruby has optional chaining too, with
&.
, haven't usedtry
in a long time 😊Take it for a spin!