function solution(n) {
    const arr = [0,1];
    let index = 2;
    
    while(true) {
        if(index > n ) {
            break;
        }
        
        const cal = (arr[index-2] + arr[index-1]);
        arr.push(cal);
        index++;
    }
    
    return arr[arr.length-1];
}

solution(10);
// 55
let len = 10;

let prevN = 1, n = 0;

for (let i = 0; i < len; i++) {
    const tmpPrevN = BigInt(n);

    n = tmpPrevN + BigInt(prevN);

    prevN = tmpPrevN;
}

console.log(n.toString());
// 55