Skip to content

Instantly share code, notes, and snippets.

@junojo
Created September 4, 2021 08:22
Show Gist options
  • Select an option

  • Save junojo/adedad79fe0bbab9f3ae97d52ce15e25 to your computer and use it in GitHub Desktop.

Select an option

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).
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