Вы попали на английскую версию сайта. Большая часть курсов доступна на русском языке

Angle Difference Course Challenge: Intro to Programming

diff.js

Create a function diff() that accepts two angles (as integer numbers), each between 0 and 360, and returns the smallest difference between them.

For example:

diff(0, 45) === 45;         // not 315, but 45, because 45 is smaller
diff(0, 180) === 180;
diff(0, 190) === 170;       // not 190, but 170, because 170 is smaller
diff(120, 280) === 160;
Successful completion: 91%

For full access to the challenge you need a professional subscription.

A professional subscription will give you full access to all Hexlet courses, the opportunity to seek help from mentors and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.

Get access
115
courses
892
exercises
2241
hours of theory
3196
tests

Last code review

User Updated at Submissions count
krivtsov 09 Mar 09:41 1