Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

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.

function isTriangle(a, b, c) {
  return (a + b > c) && (a + c > b) && (b + c > a);
}isTriangle(1, 1, 1);  // true
isTriangle(1, 1, 2);  // false
isTriangle(1, 2, 2);  // true
Source by medium.com #
 
PREVIOUS NEXT
Tagged: #Implement #function #accepts #integer #values #The #function #return #true #triangle #built #sides #length #false
ADD COMMENT
Topic
Name
8+8 =