Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tnolet
Last active October 6, 2022 14:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tnolet/8cada720470efc7abc1cd564714963ec to your computer and use it in GitHub Desktop.
Save tnolet/8cada720470efc7abc1cd564714963ec to your computer and use it in GitHub Desktop.
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
Copy link

adnasa 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