Young Coder
Published in

Young Coder

The Art of JavaScript Cloning

There’s a right way and a wrong way to make copies of custom objects

It should be simple. You have a small object. Maybe something like this, defined here with object literal syntax:

const student = {
studentId: '445-13-196',
firstName: 'Tazie,
lastName: 'Yang',
dateOfBirth: new Date(1995, 8, 15)
};

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Matthew MacDonald

Teacher, coder, long-ago Microsoft MVP. Author of heavy books. Join Young Coder for a creative take on science and technology. Queries: matthew@prosetech.com