"Work Around" Project help!

Hey everyone! I keep getting an error on this project and I have no clue why. Everything was fine until the last step I think. Here’s my code in workAround.js:

import {getCadre, calculateTax, getBenefits, calculateBonus, reimbursementEligibility} from './employee';
import Employee from './employee';

function getEmployeeInformation(salary) {
  Employee.salary = salary;
  console.log('Cadre: ' + getCadre());
  console.log('Tax: ' + calculateTax());
  console.log('Benefits: ' + getBenefits());
  console.log('Bonus: ' + calculateBonus());
  console.log('Reimbursement Eligibility: ' + reimbursementEligibility() + '\n');


And this is the error I keep getting:

  _employee2.default.salary = salary;

TypeError: Cannot set property 'salary' of undefined
    at getEmployeeInformation (workAround.js:5:3)
    at Object.<anonymous> (workAround.js:13:1)
    at Module._compile (module.js:571:32)
    at loader (/home/ccuser/node_modules/babel-register/lib/node.js:158:5)
    at Object.require.extensions.(anonymous function) [as .js] (/home/ccuser/node_modules/babel-register/lib/node.js:168:7)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Function.Module.runMain (module.js:605:10)
    at /home/ccuser/node_modules/babel-cli/lib/_babel-node.js:171:48

I even copied what was in the hint but for some reason it’s still wrong. I feel like it’s something really small. Can anyone help? Thanks!

Hi @shershorn

What is Employee here? And how did you export it?

Looks like Employee is not imported and it’s equal to undefined. Did you try this:
import { Employee } from './employee'; ?

1 Like