Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions challanges/code-challange-4/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"globals" : {
"Handlebars": true,
"$": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 6
},
"env": {
"browser": true,
"jquery": true,
"node": true,
"es6": true,
"jest": true
},
"rules": {
"eqeqeq": ["error", "always"],
"no-template-curly-in-string": "error",
"no-console": "off",
"no-undefined": "off",
"indent": ["error", 2],
"quotes": ["warn", "single", {"allowTemplateLiterals": true}],
"no-multi-spaces": ["warn", {"exceptions": { "VariableDeclarator": true }}],
"no-trailing-spaces": "warn",
"new-cap": "warn",
"no-redeclare": ["error", { "builtinGlobals": true }],
"eol-last": "error"
}
}
8 changes: 8 additions & 0 deletions challanges/code-challange-4/__test__/code-challange4.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

let validator = require('../code-challange4.js');
describe('Fibonacci Module',()=>{
it('validate the output arr ' ,()=> {
expect(validator(8)).toEqual( 21 )
});
})
11 changes: 11 additions & 0 deletions challanges/code-challange-4/code-challange4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';
function fibFunction(x){
let array = [0, 1];
for (let i = array.length; i < x + 1; i++){
let sum = array[i - 2] + array[i -1];
array.push(sum)
}
return array[x]
}

module.exports = fibFunction ;
Loading