WhatsApp has today rolled-out a new privacy feature that lets you control who can add you to a group.
You can activate this option by going to Settings > Account > Privacy > Groups menu. There you will see three more options – ‘Everyone’, ‘My contacts’, and ‘Nobody’. Selecting ‘Everyone’ will let everyone with your WhatsApp number add you to a group.
The ‘My contacts’ option will limit the feature to people whose numbers are already saved in your contacts. And, choosing the ‘Nobody’ option will prevent everyone from adding you to a group.

Those who cannot add you to a group will be able to send you a private invitation to join a group. You will then have 72 hours to accept the invitation after which the invite will expire.
This feature is rolling out to the users on the latest version of WhatsApp, and it will reach everyone around the globe in the coming weeks.