JavaScript: Integer reverse

Last update: 04 Dec 23:20
1
Student
100%
Completion rate

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