function reverseGivenInteger(num) {
// write your solution here
let reverse = 0;
while(num !== 0){
reverse = (reverse * 10) + (num % 10);
num = Math.floor(num / 10);
}
return reverse;
}
reverseGivenInteger(12345);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter