Question 88
Question
Answer
const obj1 = { name: "Alice", friend: obj2 };
const obj2 = { name: "Bob", friend: obj1 };
try {
const jsonString = JSON.stringify(obj1);
console.log(jsonString); // Output will likely include a placeholder like "Circular"
} catch (error) {
console.error("Error serializing circular object:", error);
}Last updated