# How could compare two arrays which is greater

Hi Programmers ,

How could I compare two arrays which is greater I need to find which array is greater . (Js)

Eg :-

array_1 =["> 90", “< 60”, “>= 50”]
array_2 =["> 70", “< 50”, “>= 30”]

array_3 =["= 50"]
array_4 =["> 70", “>= 30”]

Hi, to be honest I do not understand your question.

If you want to compare the lengths of the array, just compare with array.length.

If you want to compare inner content of the array, then explain exactly what should happen? What the final result you want to expect?

You will need to define the process of how to determine what you mean by greater with respect to comparing the arrays? What is the comparison criteria?

Hi @UATyroni ,
I need to compare with inner content and to find which array is greater !

Compare in what way? You have not yet explained how you are currently supposed to make the comparison. You should give us an example of two arrays and how you determine which one is greater.

In Here Array_1 is greater than array Two

array_1 = ["= 70"] ==> array_1 = 70
array_2 = ["= 50"] ==> array_2 = 50

array_1 = ["< 80" , “> 70”] ==> 80 < array_1 > 70
array_2 = ["> 40" , “<=20”] ==> 20 <= array_2 > 40

So is there any possible way to find which is greater as first example above. Hope you understand my question

So is the process to ignore any non-digit characters of the strings inside each array, convert the digits to numbers and find the array which has the largest number of the two arrays?

Going back to the example above, how do you determine which is greater? Is it array_1 because of the `90`?

Also, may I ask why you need to accomplish such a task? What is purpose of such a comparison in your application?

Yup my decision rely on that only is there any possible way to find it

Can you answer my last two questions in detail? Thank you.

Thanks @RandellDawson I will get back to you I am also little bit confuse on it , Anyway Thanks for your effort

Guys,

Please visit RoboGuru, coding tool Website for applied coding challenges, puzzles and games. Try to download get a copy of yours in quick 2 minutes. Participate in global competitions.