If you want to retrieve SharePoint current version information, then just open your SharePoint site and after that open your browser developer console and write below script in the console and Hit enter, the Current version information will be alert:
var uiVersion;
switch(_spPageContextInfo.webUIVersion)
{
case 12:
uiVersion="SharePoint 2007";
break;
case 14:
uiVersion="SharePoint 2010";
break;
case 15:
uiVersion="SharePoint 2013";
break;
default:
uiVersion="(unknown)";
break;
}
message = "Welcome to the "+_spPageContextInfo.webTitle +" site, loacated at "+ _spPageContextInfo.webAbsoluteUrl+"."
message+="\n\nCurrently you are browsing the site in "+_spPageContextInfo.currentCultureName +" using the "+uiVersion +" user interface";
alert(message);
Looks like:

As you see the "_spPageContextInfo" variable contains some relevant infomation about the SharePoint site.
So you can use ctx and _spPageContextInfo variables to get many information about the current page content and the page.
Learn more! Explore more.......
Thank you