prototype design pattern typescript

The solution for “prototype design pattern typescript” can be found here. The following code will assist you in solving the problem.

interface IPrototype {
getClone(): InstanceType

class Person implements IPrototype {
public name: string
public age: number
public hobby: string

constructor(name: string, age: number, hobby: string) { = name
this.age = age
this.hobby = hobby

public getClone(): InstanceType {
return this

const john: Person = new Person(‘john doe’, 30, ‘programming’)

const jane = john.getClone() = ‘jane doe’
jane.hobby = ‘swimming’


const ari = john.getClone() = ‘ari gunawan’
ari.age = 25
ari.hobby = ‘music’


Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

inline scripts encapsulated in