> For the complete documentation index, see [llms.txt](https://asad-razvi.gitbook.io/javascript-cookbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://asad-razvi.gitbook.io/javascript-cookbook/object-recipes/how-to-instantiate-a-class-using-an-object-of-that-class.md).

# How to instantiate a class using an object of that class?

```jsx
// How to instantiate a class using an object of that class
class Point {
  constructor(x, y) {
    this.x = x
    this.y = y
  }
  toString(){ return `(${this.x},${this.y})` }
}

const topLeft = new Point(0, 0)
const bottomRight = new topLeft.constructor(10, 10)
console.log(`topLeft is ${topLeft} bottomRight is ${bottomRight}`)
```
