Javascript: Remove an item from an array

I need to remove a specific item from a Javascript array. I'm sure there are lot of ways to do it, but this is a quicky function I came up with to do it.

// Loop through an array removing any matching items
function remove_item_from_array(needle, haystack) {
    var ret = [];

    for (i in haystack) {
        var item = haystack[i];

        if (item !== needle) {
            ret.push(item);
        }
    }

    return ret;
}


Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 3.229.142.175
To prevent spam please submit by clicking the kitten: