Created
March 11, 2018 02:25
-
-
Save dance2die/dedfbb43f3b0b32820ac960b0b4a4533 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.min = function(propertySelector) { return Math.min(...this.map(propertySelector)) }; | |
Array.prototype.max = function(propertySelector) { return Math.max(...this.map(propertySelector)) }; | |
function minMaxDemo(orders) { | |
const minimumQuantity = orders.min(order => order.quantity); | |
const maximumQuantity = orders.max(order => order.quantity); | |
WriteLine(`Minimum Quantity: ${minimumQuantity}`); | |
WriteLine(`Maximum Quantity: ${maximumQuantity}`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment