在页面加载后 10 秒更改布尔变量



我怎样才能允许它先为真,然后在 10 秒后,它会变成假?

MemoryGame.Card = function(value) {
this.value = value;
this.isRevealed = false;
this.reveal = function() {
this.isRevealed = true;
}
this.conceal = function() {
this.isRevealed = false;
}
};

你可以看看 Window setTimeout() 方法。所以你的代码可能是这样的:

window.setTimeout(function() { conceal(); }, 10000);

最新更新