JavaScript Class instance 3/12


#1

Hello, was just wondering if anyone wouldn’t mind showing me where I’m going wrong with this if they can please and thank you

class Surgeon {
constructor(name, department) {
this.name = name;
this.department = department;
}
}

const surgeonCurry = new Surgeon(‘curry’ + ‘Cardiovascular’)
console.log(surgeonCurry.name);
console.log(surgeonCurry.department);

const surgeonDurant = new Surgeon(‘Durant’ + ‘Orthopedics’)
console.log(surgeonDurant.name);
console.log(surgeonDurant.department);

  • name is generating fine to the console. However, department isn’t for some reason

#2

Use comma separated arguments.

Check the parameter list…


#3

Ahhh thank you. Sorted it :slight_smile: