Last active
January 12, 2020 14:58
-
-
Save WimJongeneel/d3effca2e6dd21b45848354a579b2421 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
net.createServer() | |
.listen(PORT, IP, BACKLOG) | |
.on('connection', socket => { | |
console.log('new connection') | |
socket | |
.on('data', buffer => { | |
console.log('data') | |
socket.write(fibonacci(100)) | |
console.log('done with connection') | |
socket.end() | |
}) | |
}) | |
const fibonacci = (n: number) => (n < 2) ? n | |
: fibonacci(n - 2) + fibonacci(n - 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment