Hi,

I am in need of a little help for an assignment I'm working on. I want to be able to click on the #foodpic div which displays a randomly generated image (from randF variable which chooses a number from an array) and with the switch statement have it output whether the click is correct or incorrect.


var correctNum = Math.floor(Math.random() * food.length);
var randF = food[correctNum];

var randS = stadiums[correctNum];

var foodChoice = randF;

$("#foodPic").click(function(e) {

switch(foodChoice == randF){
case "Right": $("#gameResult").html('<h1>Congratulations! You are correct!</h1><br><input name="resetButton" type="reset" id="resetButton" value="Play Again">');

$(".points").html('You earned ' + point + ' points');
$(".totalPoints").html('Total: ' + pointTotal);
pointTotal+=5;
break;


default:
$(".choice").html("Wrong. Please guess again.");
$(".points").html('You lost ' + lpoint + ' points');
$(".totalPoints").html('Total: ' + pointTotal);
pointTotal-=2;

}