<script type="text/javascript">var str = "abcdefg"; document.write(str.split("").reverse().join(""));
</script>