Notification.requestPermission() - Web APIs | MDN (mozilla.org)

Notification.requestPermission().then(function(permission) { ... });