re: Daily Challenge #84 - Third Angle of a Triangle VIEW POST

FULL DISCUSSION
 

My solution in js

const thirdAngle = (angle1, angle2) => (angle1 && angle2 && (angle3 = 180 - (angle1 + angle2)) > 0) ? angle3 : 'Invalid - Sum of all angles of a triangle should be 180 degrees';
 
 

Good catch. Edited. But the challenge is to deal with positive integers so didn't take 0 into account as it is neither positive nor negative integer.

True enough. But why code purely for specs when coding for the edge and error cases takes just a few more minutes?

code of conduct - report abuse