Looking for assistance on a coding issue I'm facing. I need my JavaScript code to read JSON data and grant access to a staff panel based on the information provided. Below is the sample JSON:
{
"User1": {
"User": "Elliott",
"StaffPanelAdvanced": "true"
},
"User2": {
"User": "Max",
"StaffPanelAdvanced": "true"
},
"Password:": "2201-hrstaffpanel"
}
My current JavaScript code snippet is as follows:
let pr = prompt("What is your staff name? (Case Sensitive)")
if (pr === data.User1.User) {
alert("Logged in successfully, " + pr + ".")
}
(Note: I am using 'fetch' to retrieve the JSON info due to issues with 'require'.) Can someone please help me figure out why this setup is not functioning correctly?