const getCircularReplacer = () => { const seen = new WeakSet(); return (key, value) => { if (typeof value === "object" && value !== null) { if (seen.has(value)) { return; } seen.add(value); } return value; }; }; JSON.stringify(circularReference, getCircularReplacer());
I also ran into this issue. It was because I forgot to await for a promise.
//The error means that the object you pass in the request has a circular reference, something like: var a = {}; a.b = a;
Game.prototype.restart = function () { this.clearLocalStorage(); this.timer = setTimeout(this.reset.bind(this), 0); // bind to 'this' }; Game.prototype.reset = function(){ this.clearBoard(); // ahhh, back in the context of the right 'this'! };