[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Errors/Too_much_recursion [Back]  [Original]

InternalError: too much recursion - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

InternalError: too much recursion

JavaScript "too much recursion" "Maximum call stack size exceeded"

RangeError: Maximum call stack size exceeded (Chrome)
InternalError: too much recursion (Firefox)
RangeError: Maximum call stack size exceeded. (Safari)

InternalError (Firefox) RangeError (Chrome Safari)

() JavaScript

10

js
function loop(x) {
  if (x >= 10)
    // "x >= 10" 
    return;
  // 
  loop(x + 1); // 
}
loop(0);

js
function loop(x) {
  if (x >= 1000000000000) return;
  // 
  loop(x + 1);
}
loop(0);

// InternalError: too much recursion

js
function loop(x) {
  // 
  loop(x + 1); // 
}

loop(0);

// InternalError: too much recursion

Class error: too much recursion

js
class Person {
  constructor() {}
  set name(name) {
    this.name = name; // 
  }
}

const tony = new Person();
tony.name = "Tonisha"; // InternalError: too much recursion

name (this.name = name;) JavaScript

**

js
class Person {
  get name() {
    return this.name; // 
  }
}

js
class Person {
  constructor() {}
  set name(name) {
    this._name = name;
  }
  get name() {
    return this._name;
  }
}
const tony = new Person();
tony.name = "Tonisha";
console.log(tony);


Web Proxy Viewer  |  New URL  |  Original Page