var str = 'ABC123EF789', newStr = str.split('').filter(function(e) { return !(e % 2); }).reverse().join(''); alert(newStr);