Updating a variable from an external file JS

I’m making a simple math app. See the math_app repo here

In the branch newQuestion I’m trying to implement a new feature.

The feature
When the inputCapture.js has validated the user answer as correct I want a new question to generate (preferably without refreshing the entire page).

There are only two javascript files. generator creates the random numbers and updates the html input values first. inputCapture takes these values and processes user input.

What do you think is the best way to approach this?

I’m currently experimenting with sharing a var from generator and updating it in inputCapture, but despite using the let keyword, it tells me that I cannot update a var declared with const.

Hi there. I took a look at your generator.js and inputCapture.js under your newQuestion branch.

To be honest, I’m having trouble conceptualizing your application, because there’s no running instance of it. I’d recommend making a replit and sharing the link. It’ll help us gain shared understanding of what you have so far, and the feature (generating a new question without refreshing the page) you envision.

Hi Liam, thanks for taking a look. Would you be comfortable opening in an ide and running npm start? This should load the application in the browser.

I’m certainly capable, but it’s a bit of a nuisance to go out of my way to clone, install, and run your project when we have tools like replit. That’s just me being honest.

If you do get it running on replit, ping me with the link and I’d be happy to take a look.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.