There are several ways to do this. If you're using Azure AD and node.js, the easiest way is to look at the X-MS-CLIENT-PRINCIPAL-NAME
HTTP request header. That will contain the email of the user.
If you want to get user information from some JavaScript code on the client, you can alternatively make an AJAX request to the site's /.auth/me
endpoint. As long as the login session cookie (currently named AppServiceAuthSession) is included in the AJAX call (which happens by default), you'll get a JSON blob that contains not only the email, but also all other claims associated with the user. This technique works on the server-side as well.