프로토타입 패턴을 사용해 Sheep 클래스를 구현하세요.
프로토타입 패턴은 기존 객체를 복제(clone)하여 새 객체를 생성하는 방법을 제공합니다. 복잡한 객체 초기화를 피하고, 원본과 독립된 새 인스턴스를 효율적으로 만들 수 있습니다.
Sheep은 name과 weight 속성을 가집니다clone() 메서드는 새로운 Sheep 인스턴스를 반환해야 합니다name과 weight**를 가져야 합니다clone !== original)weight를 변경해도 원본의 weight는 변하지 않아야 합니다const dolly = new Sheep('Dolly', 50);
const clone = dolly.clone();
console.log(clone.name); // 'Dolly'
console.log(clone.weight); // 50
console.log(clone !== dolly); // true
clone.weight = 60;
console.log(dolly.weight); // 50 — 원본 영향 없음!