我已经click为一个按钮添加了一个事件监听器.它调用按钮YESAND NO.基本上indexOf检查变量中的值foto是在yesMeetup数组中还是在notMeetup数组中.
我尝试调试,但我总是得到"你得到它",当我点击NO按钮时,它不会调用调试器
let foto = Math.floor(Math.random() * 20) + 1;
document.querySelector('.btn').addEventListener('click', verify);
function verify() {
var yesMeetup = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15];
var notMeetup = [16, 17, 18, 19, 20];
var notButton = document.getElementById('no');
var yesButton = document.getElementById('yes');
var decisao = document.getElementById('decisao');
debugger;
if (yesButton) {
if (yesMeetup.indexOf(foto)) {
decisao.textContent = "You got …Run Code Online (Sandbox Code Playgroud)