Converting a project in the console, to include the UI?

https://github.com/callum-laing/build-progression

Github repo attached for code reference.

This isn't anything fancy, it's just a project for me to understand how to push the JS into the UI.

I want to use the addItem function and change the prompt into whatever the user submits in the html form. I'm not sure how to do that? I believe I can call the function using an onclick on the submit part of the form to actually add the item + quantity to the inventory, but I'm not sure how I change the prompt variables from a prompt, to whatever the user inputs in the 2 form fields...

const addItem = () => {
  let productName = prompt("Enter the name of the product you want to add: ");
  let count = prompt("Enter the quantity: ");
  let newCount = parseInt(count);

  console.log(`You added ${productName}, with a quantity of ${newCount}`);

  addProduct(productName, newCount);
};
GitHub
Multiple step layered progression from console to UI - GitHub - callum-laing/build-progression: Multiple step layered progression from console to UI
GitHub - callum-laing/build-progression: Multiple step layered prog...
Was this page helpful?