If you are into SharePoint development, then you should be familiar with your best friend _spPageContextInfo which gives you more valuable context-based information. In classic SharePoint Pages, you can access it directly like below:
You can also access the same now from SharePoint Framework too.
Below is the complete list of object’s properties which sample values,
Reference - https://rjesh.com/spPageContextInfo-spfx/