View Full Version : Duplicate checking in an Array. please help

08-03-2006, 02:12 AM
I am new to JavaScript programming. Could any one help me in solving this problem? My problem is to find the duplicate value in the array.

I have a single dimension array with the following data stored on it.

a[0] = 1~1~10
a[1] = 1~2~11
a[2] = 1~3~15
a[3] = 1~4~19
a[5] = 1~6~10

Here in my case a[0] and a[5] is duplicate because i am using 1 or 0 for active and deactivate purpose a[4] is deactivate value so we can ignore the 10 in this. so in my case 10 is repeated twice on a[0]and a[5] not a[4], so its duplicate value. can any one help me to solve this.
Thanks you.

08-03-2006, 01:59 PM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


<script language="JavaScript" type="text/javascript">
var a=[];
a[0] = '1~1~10'
a[1] = '1~2~11'
a[2] = '1~3~15'
a[3] = '1~4~19'
a[5] = '1~6~10'
var mtch='';
var ary=[];
for (var zxc0=0;zxc0<a.length;zxc0++){
if (a[zxc0]){
var key=a[zxc0].split('~')[2];
if (!mtch.match(key)){


08-04-2006, 04:24 AM
Thanks alot vwphillips for you time. problem resolved :)