Why does cats and dogs have whiskcer

Cats and dogs have whiskers because it functions for navigation, mood indication, & measuring opening.