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