Skip to content

Instantly share code, notes, and snippets.

@tnolet
Last active Oct 6, 2022
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
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