Assignment #5 Part 1 - Adding Validation, require error

Hi guys, I see the note that there’s an error associated with require(‘isomorphic-fetch’); from scriptHelper.js - that’s fine.

But I’m trying to import my formSubmission() function from scriptHelper.js to script.js and I’m getting a require error again and none of the code that I’ve written in formSubmission() seems to be getting through to the webpage.

I’m confused as to how script.js and scriptHelper.js are interacting with each other? Should all the module.exports at the bottom of scriptHelper.js (below) be an object that I then refer to by . notation in script.js? See screen grabs of my code so far. I know the script.js code is wrong but I’m not sure how to go from here.

module.exports.addDestinationInfo = addDestinationInfo;
module.exports.validateInput = validateInput;
module.exports.formSubmission = formSubmission;
module.exports.pickPlanet = pickPlanet;
module.exports.myFetch = myFetch;

script

Both files are interacting with each other through index.html (I am pretty sure). You do not need to add any import/export statements between both files. Only keep the ones that were originally provided & you are set!
Line 2 on script.js was added automatically by VSC to “help” you but it should be taken out - more harm than good!

1 Like