How to mask Photoshop layer effects

Have you ever wanted to mask a part of a layer effect, but not the image itself? Here’s a really quick way to do it:

I don’t know in what version Adobe introduced this feature. If you happen to know, please share in the comments. For this tutorial I used Photoshop CC 2017.