Purge an array of an object

snipped by Schyfis

I use this code in almost every game I make. It removes all instances of an object from a given array and returns a new array. Feel free to use it, it's really simple.

Usage: testArray=["hello", "goodbye"]; testArray=purge(testArray, "hello"); //testArray is now ["goodbye"]

purge = function (ar, obj) {
	var tar = [];
	for (var a = 0; a<ar.length; a++) {
		if (ar[a] != obj) {
			tar.push(ar[a]);
		}
	}
	return tar;
};