编写一个函数将Fibonacci字返回到N.N将作为参数提供给函数。该函数应返回一个对象数组。对象的形式应为:{N:1,长度:1,熵:0,单词:'1'}。更多细节如下:
Fibonacci Word可以类似于Fibonacci Sequence的方式创建, 如下所述 :
将F_Word 1定义为1
将F_Word 2定义为0
将F_Word 3表示为F_Word 2与F_Word 1连接,即:01
将F_Word n表示为F_Word n-1与F_word n-2连接
fibWord
是一个功能。
testString: 'assert(typeof fibWord === "function", "fibWord
is a function.");'
- text: fibWord(5)
应该返回一个数组。
testString: 'assert(Array.isArray(fibWord(5)),"fibWord(5)
should return an array.");'
- text: 'fibWord(5)
应该返回'+JSON.stringify(ans)+'
。'
testString: 'assert.deepEqual(fibWord(5),ans,"fibWord(5)
should return "+JSON.stringify(ans)+"
.");'
```