Here are a few solutions for when the onclick
function is trying to access out-of-scope data.
This one is probably the most confusing, but functions that return functions is a common practice in JavaScript, so it's something you'll want to get familiar with. You can create a function that knows the full scope of what you need and returns a unique function that calls the alert with a given text.
function getPrizeFunction(prizeText) {