Concatenate suffixes of a String | Function to print the expansion of the string ; Take sub - string from i to n - 1 ; Print the sub - string ; Driver code
function printExpansion ( str ) { var suff = " " ; for ( var i = str . length - 1 ; i >= 0 ; i -- ) { suff = suff + str [ i ] ; document . write ( suff ) ; } } var str = " " ; printExpansion ( str ) ;