[英]Function into function call javascript
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, '.', ',');
}
};
Final solution from OPs comments: - OP的最终解决方案评论:-
Just add the correct function call in the place you'd like it to appear.
只需在您希望它出现的位置添加正确的函数调用即可。
$('#game-over').html("Game Over!<br \>You would've won " + self.formatMoney());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.