Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
1) Pythagoras' theorem only holds true for a right triangle, not for all triangles.
2) You can't rely on c always being the hypotenuse in a right triangle. Hint: the hypotenuse in a right triangle is always the longest side.
3) = and == and === are different things. -
Found some click bate site with the rules: https://sciencing.com/rules-length-...
-
The sum of 2 sides of a triangle is always larger than the remaining side. So I think this should work
return a+b > c && a+c > b && b+c>a -
@radekwlsk it should be &&. Consider lengths 4, 2, 6 according to you it will give true because 4+6>2 but 4+2!>6 therefore, it should be false
-
musma3246yJust a tip to prettify your code. You don't need to use an if-else block there. "If <condition> then TRUE else FALSE" it's equivalent to "return <condition>".
-
Sort the inputs.
The largest value (the last entry of the sorted array, side_lengths[2], for example) must be less or equal (operator <=) to the sum of the first two (side_lengths[0] + side_lengths[1]).
so i have to practice on codewars for homework and my code.. doesnt work! what a surprise. i was wondering if anyone could tell me whats wrong since yall are professionals. its probably a stupid mistake. this is the challenge: Implement a method that excepts three integer values a, b, c. The message return true if a triangle can be built with the sides of given length and false in any other case.
question
codewars
newbie
help me
javascript