Hey, thanks for reading! Yeah, your way is what I usually do in code I write. I was a bit on the fence about the style to use in this post, and ended up deciding for the lambda because I thought that might be more accessible, although that is entirely debatable :).
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.