← Back to challenges

Reverse the Number

JavaScriptHardmathnumbersformatting

Instructions

Create a function that takes an integer n and reverses it.

Examples

rev(5121) ➞ "1215"

rev(69) ➞ "96"

rev(-122157) ➞ "751221"

Notes

  • This challenge is about using two operators that are related to division.
  • If the number is negative, treat it like it's positive.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Get Sum of People's Budget