鍍金池/ 問答/網(wǎng)絡(luò)安全  HTML/ 如何在devtools中重復(fù)執(zhí)行代碼?

如何在devtools中重復(fù)執(zhí)行代碼?

比如我有如下代碼

var eightBall = { index: 0,
advice: ["yes", "no", "maybe", "not a chance"],
shake: function() {
this.index = this.index + 1;
if (this.index >= this.advice.length) { this.index = 0;
} },
look: function() {
return this.advice[this.index];
}
};
eightBall.shake(); console.log(eightBall.look());

希望得到如圖結(jié)果:
clipboard.png
那么我需要多次執(zhí)行最后一行代碼,在開發(fā)者工具中應(yīng)該如何做呢?

回答
編輯回答
笑浮塵

優(yōu)化一下樓上答案.

圖片描述

2017年8月24日 18:17
編輯回答
檸檬藍

多敲幾次唄。。

clipboard.png

2017年9月1日 03:25