Last active
October 6, 2022 14:19
-
-
Save tnolet/8cada720470efc7abc1cd564714963ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
typo on L4. it should be
fib()
, since your function name isfib