Out of pure bored-ness, I created a JavaScript game inspired by the TV show called Breakaway.
I've already whipped up a piece of JS code, and I will share it to you, right in this post.
var money = 0;
var breakAway = false;
var questionNumber = 0;
function question(question,correctAnswer) {
if (questionNumber == 30) {
alert ("You won with £" + money + "!");
return;
}
if (questionNumber % 3 == 0) {
if (!breakAway) {
breakAway = confirm("Before I ask the next question, you have a choice to break away.");
}
}
var supQu = questionNumber + 1;
var answerSelected = prompt("Question " + supQu + ": " + question,"");
if (answerSelected == correctAnswer) {
money = money + 100;
alert("Correct! Money is now " + money + "!");
} else {
if (breakAway) {
document.write("You are eliminated!");
} else {
money = 0;
alert("Wrong! Money reset to 0.");
}
}
questionNumber++
}Offline
Nice.
Offline
What is Breakaway?
Offline