For this Question: Given a positive integer N, your task is to print a right-angle triangle pattern of consecutive numbers of height N.
See the example for a better understanding.<b>User Task:</b>
Since this will be a functional problem, you don't have to take input. You just have to complete the function <b>pattern()</b> that takes integer n as a parameter.

Constraint:
1 <= N <= 100Print a right angle triangle of numbers of height N.Sample Input:
5

Sample Output:
1
1 2 
1 2 3
1 2 3 4
1 2 3 4 5

Sample Input:
2

Sample Output:
1
1 2, I have written this Solution Code: function pattern(n) {
    // write code herenum
    for(let i = 1;i<=n;i++){
        let str = ''
        for(let k = 1; k <= i;k++){
            if(k === 1) {
                str += `${k}`
            }else{
                str += ` ${k}`
            }
        }
        console.log(str)
    }
}, In this Programming Language: JavaScript, Now tell me if this Code is compilable or not?