My code (below) is supposed to chronicle if the button is clicked, and register the said click as a certain selection depending on the button pressed. Unfortunately when I check both the item function and itemselector function after clicking one of the buttons, I currently am just getting an undefined value
if (document.querySelector("button name="item1").click) {
let itemselector = 1;
}
if (document.querySelector("button name="item2").click) {
let itemselector=2;
}
if (document.querySelector("button name="item3").click) {
let itemselector=3;
}
function itemselector{
if (itemselector===1) {
then let item==="item1"
}
if (weaponselector===2) {
then let item==="item2"
}
if (weaponselector===3) {
then let item==="item3"
}