Copy and paste the following script.
<script language="ecmascript" type="text/ecmascript">
var item;
var list;
var file;
function fileMajorandMinorVersion() {
var clientContext = SP.ClientContext.get_current();
if (clientContext != undefined && clientContext != null) {
var webSite = clientContext.get_web();
this.list = webSite.get_lists().getByTitle("Shared Documents");
this.item = list.getItemById(16);
this.file = this.item.get_file();
clientContext.load(this.file);
clientContext.executeQueryAsync(Function.createDelegate(this, this.OnLoadSuccess), Function.createDelegate(this, this.OnLoadFailed));
}
}
function OnLoadSuccess(sender, args) {
var version = "Major Version: " + this.file.get_majorVersion() + '\n' + "Minor Version: " + this.file.get_minorVersion();
alert(version)
}
function OnLoadFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}</script>
<input id="btnFileMajorandMinorVersion" onclick="fileMajorandMinorVersion()" type="button" value="File Major and Minor Version"/>