Можно так:
function myParseInt(n) { n = parseInt(n); if ( typeof n !== 'number' || !isFinite(n) ) n = 0; return n; }