How might I find the largest number contained in a JavaScript array?

I have a simple JavaScript Array object containing a few numbers. [267, 306, 108] Is there a function that would find the largest number in this array? 32 Answers 32 Resig to the rescue: Array.max = function( array ){ return Math.max.apply( Math, array ); }; Warning: since the maximum number of arguments is as low … Read more

max value of integer

In C, the integer (for 32 bit machine) is 32 bits, and it ranges from -32,768 to +32,767. In Java, the integer(long) is also 32 bits, but ranges from -2,147,483,648 to +2,147,483,647. I do not understand how the range is different in Java, even though the number of bits is the same. Can someone explain … Read more

How to perform .Max() on a property of all objects in a collection and return the object with maximum value [duplicate]

This question already has answers here: How to use LINQ to select object with minimum or maximum property value (19 answers) Closed 6 years ago. I have a list of objects that have two int properties. The list is the output of another linq query. The object: public class DimensionPair { public int Height { … Read more