JSFiddle - React, Tailwind, and code Playground
by irinablue
JavaScript
const p = {
"title": "sntk onCustomClick",
"payload": {
"rule": {
"RuleId": 104,
"RuleName": "new year beer",
"RequiredFields": null,
"ImpressionVariable": 0,
"TrackVisualImpression": false,
"EventId": 510,
"EventName": "test cookie button",
"Path": ".block-cookies__button,.block-cookies__button *",
"Type": "click",
"Uri": "",
"DynamicContent": false,
"BlockId": 367,
"Variables": null
},
"event": {
"isTrusted": true
},
"selector": ".block-cookies__button"
}
};
const circularReference = {otherData: 123};
circularReference.myself = circularReference;
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());
//console.log(q1, q2)