WorkAround Explorer Doubts

So I am having some doubts with the exercise. I have done steps 1 trhough 4 for I don’t get the output I belive the system should return.

I start by exporting the required pieces of salaryData like this

 export { getRoles, getCompanies, getDataByrole, getDataByCompany};
 export default salaryData;

I run the program and nothig changes. Then i go to step too and import the files in main.js

import {getRoles, getCompanies} from './modules/salaryData.js'

If I click run again, only the details column in the browser remains. I initially though that it was because I had to finish but even when I reach step 4 nothing changes.

Step 3 I wrote as followed

const companies = getCompanies();
const roles = getRoles();

And lastly I set the type to module in the index.html, but still nothing changes and I cannot do what step 4 of the exercise tells me to do. I really don’t see what I am doing wrong and I even tried to look at the hints but to me they seem to point to the same code I am using.

Could someone please help me?
Thanks!

Could you provide a link to the exercise, please?
There is also another file, workAroundExplorer.js. What did you import there?

Are your exports from salaryData in the end of the file (at the bottom)?

Also, make sure to reference main.js in index.html script tag with type set to module. Do you have something like this?

    <script type="module" src="main.js" defer></script>

@mirja_t here is the link https://www.codecademy.com/paths/full-stack-engineer-career-path/tracks/fscp-javascript-syntax-part-iii/modules/fscp-learn-javascript-syntax-modules/projects/es6-modules-workaround

I have not added nothing to the Workaround file because the instructions tackle that file after step 4 and I have not gotten beyond that yet cause I want the first part to work properly first.

@mike7127143742 yes to both. I did not include the module thing in my previous code but I have set it

A little Déjà vu, maybe :wink:

1 Like

As a technique to find small bugs like this in the future, you can open up Chrome dev-tools and view the console. It should show something like this:
Uncaught SyntaxError: Export ‘getDataByrole’ is not defined in module

1 Like

Ok I think I should stop for today lol. However 2 questions:

  1. Shouldn’t it be uninfluential at least for the time being considering I am not calling that function for the first part of the exercise? I would have expected it to be an issue if I had written getcompanies of getroles without the camelcase
  2. Did you add the second import on dataSalary or I am completely losing it? I just noticed it and I really don’t remember seeing it last time

When you export it, you’re referencing a variable that doesn’t exist. That is a problem already occurring in salaryData.js.

Do you mean if I edited your post? No, I can’t do that.