/**
* @param {number} x
* @return {number}
*/
var reverse = function(x) {
x = x + '';
let reversedStr = x.split('').reverse().join('');
if(reversedStr.includes('-')) {
reversedStr = reversedStr.split('-')[0]
reversedStr = '-'+reversedStr
}
if(2147483647 < reversedStr || -2147483648 > reversedStr) {
return 0
}
return reversedStr
};