Javascript Class Instance - 3/12


help me …why am i getting this error…

const surgeonCurry = new name(‘Curry’);

ReferenceError: name is not defined
at Object. (/home/ccuser/workspace/learn-javascript-classes-classes-instance/main.js:8:26)
at Module._compile (module.js:571:32)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)
at bootstrap_node.js:542:3

thank you


we talked about this in earlier topic, if you don’t include your full code, its nearly impossible to tell what is causing the error


yes …sorry wait…

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

const surgeonCurry = new name('Curry');



const surgeonCurry = new name('Curry');

why use new name? You want to create a new instance of Surgeon

the general syntax is:

const instance = new Class('possible arguments');


wait …i will try and tell


you don’t have to tell me you are going to try, i assume you would. Just report back with the results


i got it bro …
it went well…
thank you very much::grinning: