Created
September 4, 2021 08:22
-
-
Save junojo/adedad79fe0bbab9f3ae97d52ce15e25 to your computer and use it in GitHub Desktop.
Implement a method that accepts 3 integer values a, b, c. The method should return true if a triangle can be built with the sides of given length and false in any other case. (In this case, all triangles must have surface greater than 0 to be accepted).
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 isTriangle(a,b,c) | |
| { | |
| var arr = [a,b,c].sort(function(a, b) { | |
| return a - b; | |
| }); | |
| return arr[0] + arr[1] > arr[2] ? true : false; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment