Javascript: Integer reverse

JavaScript fundamentals
Last update: 15 Jun 07:39
0
Students

solution.js

Implement and export as default a function that reverses the digits in the passed number and returns a new one.

Examples:

reverseInt(13); // 31
reverseInt(-123); // -321
reverseInt(8900); // 98

Tips

  • To get a string length use the str.length
  • You may need the Math.abs() function

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
900
exercises
2000+
hours of theory
3200
tests