const memo = {};

function fib(n) {
    if (n in memo) {
        return memo[n];
    }
    
    if (n <= 2) {
        result = 1;
    } else {
        result = fib(n - 1) + fib(n - 2);
    }
    
    memo[n] = result;
    return result;
}

for (let i = 1; i < 10; i++) {
    console.log(fib(i));
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: