You can try Contextinfo API call to get the version of SharePoint.
Kindly revert back if you need any further information.
All the best.