Skip to content

Instantly share code, notes, and snippets.

@codermarcos
Created April 17, 2018 14:47
Show Gist options
  • Save codermarcos/88ee821de24a5ac5e50e5f267c95fafe to your computer and use it in GitHub Desktop.
Save codermarcos/88ee821de24a5ac5e50e5f267c95fafe to your computer and use it in GitHub Desktop.
TypeError cyclic object value
var a = {};
var b = {};
a.b = b; // Cria a referencia em a para o B
b.a = a; // Cria a referencia em b para o A,
console.log(a);
// a: Object { b: [circular object] }
JSON.stringify(a); // TypeError: cyclic object value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment