Javascript: Perfect numbers

JavaScript fundamentals
Last update: 14 Sep 06:31
0
Students

isPerfect.js

Create a function isPerfect() that takes a number and returns true if it's perfect, and false otherwise.

A perfect number is a positive integer that is equal to the sum of its proper positive divisors excluding the number itself. For example, 6 is perfect, because 6 = 1 + 2 + 3.

isPerfect(6); // true
isPerfect(7); // false

Tips

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

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

Get access
130
courses
1000
exercises
2000+
hours of theory
3200
tests