# Compare multiple values in an array

**URL:** <https://forum.kirupa.com/t/compare-multiple-values-in-an-array/181378>\
**Category:** Uncategorized\
**Created:** [March 8, 2006, 7:51pm UTC](https://forum.kirupa.com/t/compare-multiple-values-in-an-array/181378 "2006-03-08T19:51:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bal](https://avatars.discourse-cdn.com/v4/letter/b/91b2a8/32.png) [@Bal](https://forum.kirupa.com/u/Bal)\
**Post date:** [March 8, 2006, 7:51pm UTC](https://forum.kirupa.com/t/compare-multiple-values-in-an-array/181378/1 "2006-03-08T19:51:42Z")

</div>

Hi, could anyone put me on the right way to solving this problem, the truth is im not even sure how to structure it before Ive even got down to coding…

the scene

```auto
values = new Array("v1", "v2", "v3", "v4", "v5");

```

I have 100+ records in this array. v1 - v5 all contain number values.

Now I have to create a for loop to find if the number of occurances if/where there is a difference of 1 between any of the “v” values.

Example  
if these were the 3 entries in my array…

values[0] = (62,63,45,35,21);  
values[1] = (14,17,211,80,73);  
values[2] = (12,34,87,88,89);

I would want a trace like…

values[0] has 1 occurance  
values[1] has 0 occurance  
values[2] has 2 occurance

Any suggestions?

Thanx
