Let me also throw in a reminder about using Script Debugger’s code completion, because it can also help you resolve issues of version availability.
Consider this code:
use AppleScript version "2.4"
use framework "Foundation"
use scripting additions
current application's NSLocale's currentLocale()'s localized
If you hit F5, the completion list won’t show
localizedStringForLocaleIdentifier: because it wasn’t available in 10.10 (AS 2.4).
If you change the AS version to 2.5 and recompile, it will appear in the list if you are running 10.12, otherwise it won’t.
So the absence or not in a completion list can be a good clue.
(Unfortunately having version 2.5 for both 10.11 and 10.12 complicates things, but for apps you can also set the minimum version in the bundle’s Info.plist file, and SD will respect that.)
In fact, I often use completion after the fact. If a bit of code isn’t working, just clicking at the end of a term and hitting F5 to see if anything appears can be a good initial sanity check.