Sorting an array of objects and the issue of maximum output

 

 

 1. The method can sort

 

 

 

2. a first array of all the property values ​​to generate a map, and then () takes the maximum value by Math.max

 

 

 

 

 

 supplement

 method returns a new array map, the new value of the original elements in the array each element of the array obtained calling process.

 

 

 map () method in the original order of the processing elements in the array elements. map does not change the original array, not to an empty array detection

Function returns the array elements in each of the processing, returns the new elements.

map array method, there is a parameter, the parameter is a function of the function has three parameters

 

 

join split method is a method of string array

Get object properties of three ways

object.keys();

Object.getOwnPropertyNames()

Determine whether the object has some properties 

name in obj // returns a Boolean value

hasOwnProperty (name) // returns a Boolean value

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/wangXinYuFarly/p/11960499.html