I am working on a game Who Wants to be a Millionaire and I want to show the amount that a USER win either he finished the game or given a wrong answer. Here is the function of wrong answer (which end the game) and I dont know how to add/call amount code into it.
// Executes the proceedure of guessing incorrectly, losing the game.
self.wrongAnswer = function(elm) {
$("#" + elm).slideUp('slow', function() {
startSound('wrongsound', false);
$("#" + elm).css('background', 'red').slideDown('slow', function() {
$("#game").fadeOut('slow', function() {
$("#game-over").html('Game Over!')
$("#game-over").fadeIn('slow');
self.transitioning = false;
});
});
});
}
// Gets the money formatted string of the current won amount of money.
self.formatMoney = function() {
return self.money().money(0, '.', ',');
}
};
$('#game-over').html('Game Over!<br \>You Would've Won ' + self.formatMoney')would probably work.formatMoneyfunction and display its result next to theGame Over!?$('#game-over').html('Game Over!<br \>You Would\'ve Won ' + self.formatMoney())- notice the function parenthesis()and the cancellation of that added quote in would've\'