The navigator.permissions API checks whether a permission, such as access to geolocation data, has been granted.
navigator.permissions