Find the minimum and maximum values in the nested object
问题 I have a deeply nested javascript object with an unlimited amout of children. Every child has a value. var object = { value: 1, children: { value: 10, children:{ value: 2, children: {...} } } } All attempts to make a recursive function did not succeed, it turned out to go down only to a lower level. 回答1: After flattening your linked list into an array, you can use Array.prototype.reduce() with an accumulator that is a tuple of min and max , starting with initial values of Infinity and