Retrive Choice Field from SharePoint 2010/2013 list CSOM

Following JavaScript uses CSOM to find all choices in a field within a SharePoint list or library.

$(document).ready(function($) {
    //Wait for sp.js to load..
    SP.SOD.executeFunc('sp.js', 'SP.ClientContext', initApp);
});

function initApp(){
    //context variables
    var context = new SP.ClientContext.get_current(), web = context.get_web(), lists = web.get_lists();
    //Call function
    getChoiceFieldFromList('ListName','ListChoiceColumn', context, lists);
}


//* RETRIVE CHOICE COLUMN FROM LIST - CSOM *//
function getChoiceFieldFromList(library, column, context, lists){
    // GETS LIST BY NAME
    var currList = lists.getByTitle(library);
    
    //LOAD CURRENT LIST
    context.load(currList);

    // Get Priority field (choice field) and load it!
    var priorityField = context.castTo(currList.get_fields().getByInternalNameOrTitle(column),SP.FieldChoice);
    context.load(priorityField);

    // CALL SERVER
    context.executeQueryAsync(onSuccessMethod, onFailureMethod); 

    function onSuccessMethod(sender, args) {

        // Get string arry of possible choices (but NOT fill-in choices)
        var choicesOutput = "";

        var choices = priorityField.get_choices();
            //looping trough choices
            for (var i = 0; i < choices.length; i++) {
                //Logging every choice
                console.log(choices[i]);
            }
    }

    function onFailureMethod(sender, args) {
        console.log(args.get_message());
           alert("oh oh!");
    }
}