<script> var str = "asa"; var str2; for (var i = str.length; i>=0; i--) { str2 ? str2 += str[i] : str2 = str[i]; } alert (str2); if (str==str2) {alert("Good");} else {alert("bad");} </script>