Đoạn code sau sẽ có kết quả:
const a = {
stringField: 'Joe',
numberField: 123,
dateField: new Date('1995-12-17T03:24:00'),
nestedField: { field: 'Nested' }
};
const b = JSON.parse(JSON.stringify(a));
console.log(
a.stringField === b.stringField,
a.numberField === b.numberField,
a.dateField === b.dateField,
a.nestedField.field === b.nestedField.field
);