In case anyone has less complicated requirements, here is my adaptation of the answer for a simple string array:
Array.prototype.pushIfNotExist = function(val) {
if (typeof(val) == 'undefined' || val == '') { return; }
val = $.trim(val);
if ($.inArray(val, this) == -1) {
this.push(val);
}
};
Update: Replaced indexOf and trim with jQuery alternatives for IE8 compatability