There is a key-value array.
var enumKeys = {1:3,2:20,3:10,4:10}; In the cycle I compare the values of the elements. You must specify the first and last (i.e., the size of enumKeys) elements.
for (var i = 2; i < enumKeys.lenght; i++) { // ... } enumKeys.lenght gives the value undefined How do I know the size of enumKeys.lenght ?