Work Around project

Hi all,

I was working in the modules project called Work Around, see link below:
https://www.codecademy.com/paths/web-development/tracks/webdev-intermediate-javascript/modules/intermediate-javascript-modules/projects/workaround

A doubt aroused to me and I was wondering if somebody could help me with it.

In step 7 we export all functions (within the module “Employee”) from employee.js to workAround.js but the payGrades object.
When importing them on workAround.js and running the code, the program works correctly.

I cannot see why it doesn’t through an error since all the functions are using the “payGrade” object which wasn’t exported from employee.js

Many thanks.

1 Like

I have the same question.

It looks as if the functions called in workAround.js are still running in employee.js even after being exported/imported, thereby maintaining their access to the payGrade object. So I’m thinking the export/import syntax just allows you to call functions in a different file, rather than actually “exporting/importing” the literal code into the current file. If that’s the case, I would only need to export the payGrade object if I wanted to use it explicitly in employee.js.

Is this the right interpretation?

It seems like it would be easier to just export/import the entire employee.js file into workAround.js so that I don’t have to keep track of what I actually need. I’m guessing this is not best-practice due to resource-management or something.