
I am trying a few approachs in order to DRY and refactor this JavaScript code, but I am not sure what will be the best option:
var rawLanguages, priorityLanguages = [], nonPriorityLanguages = [],
sortedLanguages = [], nonPriority = false, i;
...