Created
November 2, 2015 09:00
-
-
Save tarzak/32997f72379b82d5f21f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function square(a) { | |
return a*a; | |
} | |
function squareMaxElements (a,b,c) { | |
var min = Math.min(a,b,c) | |
, arr = [a,b,c] | |
; | |
return arr = arr.filter(function (element) { | |
return element !== min | |
}).reduce(function(previous, next) { | |
return square(previous) + square(next) | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Be liberal in what you accept, and conservative in what you send
or
Expect the worst. Behave your best
.Coul you provide more bullet proof solution?