JavaScript Calling twice a recursive function

What I would like to do is calculate the value of a coordinate in the pascal triangle, I got a table with X and Y axis where I have my pascal triangle aligned at the top and the left, what I'm trying to do is to create a function to return the value in a specific point [ for example (3,2) = 2 ] Here's what I've tried:

var getCalc = function value( x, y ) {

    if( y == 0 || y == x ){
        return 1;
    }

    return value(x - 1, y - 1) + value(x - 1, y);
}

Here's the table with the pascal triangle:

enter image description here What we got here is a recursive function called twice in the last return, when executing it I get the following error:

Uncaught RangeError: Maximum call stack size exceeded

Also I would like to know how could I do it using ES6

Answer:1

I've given some thoughts on declaring a variable called undefined and evaluating a truthy if-else expression with it. I found out that it is not possible in global scope. But in MDN I've found some ...

I've given some thoughts on declaring a variable called undefined and evaluating a truthy if-else expression with it. I found out that it is not possible in global scope. But in MDN I've found some ...

How i can update value in database using objection ? My SQL query works perfect. UPDATE "freePlace" SET number = number-1 WHERE date >= '2017-10-20' AND date <= '2017-10-30' AND "idObject" ...

How i can update value in database using objection ? My SQL query works perfect. UPDATE "freePlace" SET number = number-1 WHERE date >= '2017-10-20' AND date <= '2017-10-30' AND "idObject" ...

I have a ng-repeat div, and inside the div have select control. This code produces parse error: <select name="qty" ng-model="Qty"> <option ng-repeat="v in [1,2,3,4,5,6,7,8,9,10]" ...

I have a ng-repeat div, and inside the div have select control. This code produces parse error: <select name="qty" ng-model="Qty"> <option ng-repeat="v in [1,2,3,4,5,6,7,8,9,10]" ...

I'm trying to use a modal triggered from the ion-header-bar to overlay on top of a google map. When I click 'login' it slides in a black screen. I've heard of including bootstrap can cause the ...

I'm trying to use a modal triggered from the ion-header-bar to overlay on top of a google map. When I click 'login' it slides in a black screen. I've heard of including bootstrap can cause the ...

  1. ionic modal slide right
  2. ionic modal slide up
  3. ionic modal-slide-in
  4. ionic modal animation slide-in-down