gpt4 book ai didi

javascript - 函数转化为函数调用javascript

转载 作者:行者123 更新时间:2023-12-03 06:53:28 24 4
gpt4 key购买 nike

我正在开发一款游戏《谁想成为百万富翁》,我想展示一下用户获胜,要么完成游戏,要么给出错误的答案。这是错误答案(结束游戏)的功能,我不知道如何在其中添加/调用金额代码。

// 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, '.', ',');
}
};

最佳答案

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());

关于javascript - 函数转化为函数调用javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37397485/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com