JavaScript program to reverse a string
var s = [ " " , " " , " " , " " , " " , " " ] ; var ans = " " ; for ( var i = 5 ; i >= 0 ; i -- ) { ans += s [ i ] + " " ; } document . write ( " " + " " ) ; document . write ( ans . slice ( 0 , ans . length - 1 ) ) ;