Skip to content

Instantly share code, notes, and snippets.

@Costava
Created June 15, 2021 06:38
Show Gist options
  • Save Costava/a7e41a206145f3a122b2f9299a83c2ed to your computer and use it in GitHub Desktop.
Save Costava/a7e41a206145f3a122b2f9299a83c2ed to your computer and use it in GitHub Desktop.
let foo = {num: 11};
let bar = {num: 22};
foo.other = bar;
bar.other = foo;
let myList = [foo, bar];
JSON.stringify(myList); // Fails
// Firefox 89: Uncaught TypeError: cyclic object value
// Chromium 91: Uncaught TypeError: Converting circular structure to JSON
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment