class Person {
constructor (name, age, married = false) {
this.name = name;
this.age = age;
this.married = married;
}
}
const person1 = new Person('박영희', 30, true);
const person2 = new Person('오동수', 18);
console.log(person1, person2);
class Dog {
bark () {
return '멍멍';
}
}
const badugi = new Dog();
console.log(badugi, badugi.bark());
function Dog2 () {
this.bark = function () {
return '멍멍';
}
}
const badugi = new Dog2();
console.log(badugi, badugi.bark());
댓글 영역