Algorithms and Data Structures Part II

Palindromes and Integer Reversal

const myNumber = 200
Math.sign(2000)  //returns 1
Math.sign(-2000) //returns -1
const myNumber = 20myNumber.tostring()
const myNumber = 20parseInt(myNumber.tostring())
const reversed = n.toString().split('').reverse().join('');
return parseInt(reversed);
if (n < 0) {
return parseInt(reversed) * -1;
return parseInt(reversed)

Learning to code, one day at a time.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store