/*
Note: Idx is the Value of the Column You want to
check for duplicates
*/
// ----------------------------
// For Single Dimensional Array
// ----------------------------
Array.prototype.chkforDuplicates = function (value)
{
// Returns true if the passed value is found in the
// array. Returns false if it is not.
var i;
var ctr = 0;
for (i=0; i < this.length; i++)
{
// use === to check for Matches. ie., identical (===), ;
if (this[i] == value)
{
return true;
}
}
return false;
};
// ---------------------------
// For Multi Dimensional Array
// ---------------------------
Array.prototype.chkforDuplicates = function (value,Idx)
{
// Returns true if the passed value is found in the
// array. Returns false if it is not.
var i;
var ctr = 0;
for (i = 0; i < this.length; i++)
{
// use === to check for Matches. ie., identical (===), ;
if (this[i][Idx] == value)
{
return true;
}
}
return false;
};
Share:
These icons link to social bookmarking sites where readers can share and discover new web pages.
