# How would you deep-clone a class?

**URL:** <https://forum.makecode.com/t/how-would-you-deep-clone-a-class/12636>\
**Category:** Help\
**Created:** [March 11, 2022, 5:52pm UTC](https://forum.makecode.com/t/how-would-you-deep-clone-a-class/12636 "2022-03-11T17:52:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hasanchik](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/hasanchik/32/5885_2.png) [@hasanchik](https://forum.makecode.com/u/hasanchik)\
**Post date:** [March 11, 2022, 5:52pm UTC](https://forum.makecode.com/t/how-would-you-deep-clone-a-class/12636/1 "2022-03-11T17:52:00Z")

</div>

I need to copy a class like this:

```auto
 export class particle {
      constructor(x:number, y:number) {
          this.x = x
          this.y = y
      }

     clone(): particle{
        return this.clone()
     }
}

```

And yeah, while i could do it like this:

```auto
     clone(): particle{
        return new particle(this.x, this.y)
     }

```

That would take alot of arguments for a class with alot of things in it. How do you clone it properly?  
All the answers online dont work with makecode arcade. (prob because the version of typescript is outdated 😉)

---

<div class="post-metadata">

**Author:** ![isoffline](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/isoffline/32/8791_2.png) [@isoffline](https://forum.makecode.com/u/isoffline)\
**Post date:** [October 12, 2022, 10:30pm UTC](https://forum.makecode.com/t/how-would-you-deep-clone-a-class/12636/2 "2022-10-12T22:30:30Z")

</div>

i thought this is HTML or PHP for some reason
