function fn (num) { let str = String(num); for(let i = 0; i < Math.trunc(str.length / 2); i++){ if ( str[i] != str[str.length-i-1]) return false } return true } alert(fn(1221))