//I want the behaviour from the first example to work with prompt(), as shown in the second example. indexOf() //does not seem to work with the prompt variable 'userInput'.
let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
let replaceGuestInput = 7;
let findIndex = arr.indexOf(replaceGuestInput);
//output 6. Intended behaviour.
console.log(findIndex);
let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const indexTest = () => {
//I type the element I want to find the index of in the prompt.
let userInput = prompt(`Type the arr element to find its index:\n${arr}`);
let findIndex = arr.indexOf(userInput);
alert(`${findIndex}`)
}
//output on index.html: -1. Unintended behaviour.
indexTest();