remove - Remove the element specified by value in JavaScript

Remove method deletes the specified value from the array. If the element is not present in the array, the array will remain unchanged.
<script type="text/javascript">
var x = new Array(2,3,4);

Array.prototype.remove = function (vItem )  {
    iIndex = this.indexOf(vItem);
    var vItem = this[iIndex];
    if (vItem) {
        this.splice(iIndex, 1);
    }
    return vItem;
};

x.remove(3);
document.write(x);
</script>


Output
2,4