logo

Is this a triangle?

Implement a function that accepts 3 integer values a, b, c. The function should return true if a triangle can be built with the sides of given length and false in any other case.


My code:


                        function isTriangle(a, b, c) {
                            if (a > 0 && b > 0 && c > 0) {
                              if (a + b > c && a + c > b && b + c > a) {
                                return true;
                              }
                            }
                            return false;
                          }
                    


And that's the best solution among all users:


                        function isTriangle(a,b,c)
{
   return a + b > c && a + c > b && c + b > a;
}