Fibonacci Word | Returns n - th Fibonacci word ; driver program
function fibWord ( n ) { var Sn_1 = " " ; var Sn = " " ; var tmp ; for ( var i = 2 ; i <= n ; i ++ ) { tmp = Sn ; Sn += Sn_1 ; Sn_1 = tmp ; } return Sn ; } var n = 6 ; document . write ( fibWord ( n ) ) ;