Define F_Word1 as 1 Define F_Word2 as 0 Form F_Word3 as F_Word2 concatenated with F_Word1 i.e.: 01 Form F_Wordn as F_Wordn-1 concatenated with F_wordn-2
n
. n
will be provided as a parameter to the function. The function should return an array of objects. The objects should be of the form: { N: 1, Length: 1, Entropy: 0, Word: '1' }
.
fibWord
is a function.
testString: assert(typeof fibWord === 'function');
- text: fibWord(5)
should return an array.
testString: assert(Array.isArray(fibWord(5)));
- text: fibWord(5)
should return [{ N:1, Length:1, Entropy:0, Word:"1" },{ N:2, Length:1, Entropy:0, Word:"0" },{ N:3, Length:2, Entropy:1, Word:"01" },{ N:4, Length:3, Entropy:0.9182958340544896, Word:"010" },{ N:5, Length:5, Entropy:0.9709505944546688, Word:"01001" }]
.
testString: assert.deepEqual(fibWord(5),ans);
```