如何在devtools中重复执行代码?

比如我有如下代码

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

希望得到如图结果:
clipboard.png
那么我需要多次执行最后一行代码,在开发者工具中应该如何做呢?

阅读 2.8k
2 个回答

优化一下楼上答案.

图片描述

多敲几次呗。。

clipboard.png

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题