Skip to content

Instantly share code, notes, and snippets.

@omardeleo
Created November 27, 2019 05:46
Show Gist options
  • Save omardeleo/890eb1aa72420bc320b1ac2308d88cbc to your computer and use it in GitHub Desktop.
Save omardeleo/890eb1aa72420bc320b1ac2308d88cbc to your computer and use it in GitHub Desktop.
var reverse = function(x) {
const rev = Math.abs(x).toString().split("").reverse("").join("");
if (rev > 2**31) return 0;
return rev * Math.sign(x);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment