Skip to content

Instantly share code, notes, and snippets.

@tnolet tnolet/numbers.js
Last active Jan 24, 2018

Embed
What would you like to do?
exports.handler = (event, context, callback) => {
const fibo = fib()
for (let i=0; i<30; i++){
console.log(fibo())
}
const result = {
"isBase64Encoded": false,
"statusCode": 200,
"headers": {},
"body": "done"
}
callback(null, result);
};
function fib() {
let x = 0
let y = 1
return function () {
const temp = x;
x = x + y;
y = temp;
return y
}
}
@adnasa

This comment has been minimized.

Copy link

commented Jan 24, 2018

typo on L4. it should be fib(), since your function name is fib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.