const num = 5;

function combinationsStairs(num){
    if(num<=2){
        return num;
    }
    
    let prev = 1;
    let current = 2;
    
    for(let i=3;i<=num;i++){
        var temp = current;
        current = current+prev;
        prev=temp;
    }
    
    return current;
}

const myVal = combinationsStairs(num);
console.log("Stairs Case Combinations for steps "+num + " is "+ myVal);

Embed on website

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