Function to copy string ( Iterative and Recursive ) | Function to copy one string to other assuming that other string has enough space . ; Driver code Driver Code
function myCopy ( s1 , s2 ) { let i = 0 ; for ( i = 0 ; i < s1 . length ; i ++ ) s2 [ i ] = s1 [ i ] ; } let s1 = " " ; let s2 = [ ] ; let index = 0 ; myCopy ( s1 , s2 , index ) ; document . write ( s2 . join ( " " ) ) ;