Algorithms and Data Structures Part II

Palindromes and Integer Reversal

const myNumber = 200
myNumber.toString()
Math.sign(2000)  //returns 1
Math.sign(-2000) //returns -1
const myNumber = 20myNumber.tostring()
const myNumber = 20parseInt(myNumber.tostring())
n.toString()
n.toString().split('').reverse().join('');
const reversed = n.toString().split('').reverse().join('');
return parseInt(reversed);
51
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