I would personally refactor your code into an object to make it easier to work with, and remove some repetitive code. Link to Object info
Your biggest issue was that you were trying to access question.value in your code, which was incorrect. prompt() simply assigns whatever is input into the variable as a string, so you should have been checking the value of just question
For the rest of it: A basic coding principle is that you do not want to repeat yourself (many call this DRY - Don't Repeat Yourself) With your code, you were repeating yourself quite a bit by using multiple if() statements with repeated instructions (alert(...) in this case). For example in the code below notice that the contents of each portion of the if statement is almost the same thing. All the changes is the array index you are calling.
if (question == nameList[0])
{
alert('Your name cost is ' + nameCost[0]);
}
else if (question== nameList[1])
{
alert('Your name cost is ' + nameCost[1]);
}...
By comparison, the code I provide below has only 1 if statement for all acceptable cases, and a catch-all else statement for if the value is not found.
<html>
<head>
<title>challenge 1</title>
</head>
<body>
<script>
var nameCost = {
'Archers': 3,
'Sparky': 6,
'Pekka': 7
};
var question = prompt('What is your card name?');
if (nameCost.hasOwnProperty(question)) {
alert('Your cost would be : ' + nameCost[question]);
} else {
alert('your cost could not be found');
}
</script>
</body>
</html>
The only alteration I would make would be to format the strings correctly, depending on if you want to keep the object with a capital letter
<html>
<head>
<title>challenge 1</title>
</head>
<body>
<script>
var nameCost = {
'Archers': 3,
'Sparky': 6,
'Pekka': 7
};
var question = prompt('What is your card name?');
question = question.charAt(0).toUpperCase() + question.slice(1);
//turns bob -> Bob
if (nameCost.hasOwnProperty(question)) {
alert('Your cost would be : ' + nameCost[question]);
} else {
alert('your cost could not be found');
}
</script>
</body>
</html>
OR if you reorganized the object to have lowercase keys
<html>
<head>
<title>challenge 1</title>
</head>
<body>
<script>
var nameCost = {
'archers': 3,
'sparky': 6,
'pekka': 7
};
var question = prompt('What is your card name?');
question = question.toLowerCase();
//turns RoBErT -> robert. Note that you could call this directly after prompt() to save space. i.e.
//prompt('what is your card name?').toLowerCase();
if (nameCost.hasOwnProperty(question)) {
alert('Your cost would be : ' + nameCost[question]);
} else {
alert('your cost could not be found');
}
</script>
</body>
</html>
question.value. It’s justquestion. Read the docs.