题库 软件开发 题目列表 以下代码执行后输出结果为(      )? <div id=&q...
单选题
以下代码执行后输出结果为(      )?
<div id="box1">
    <div id="box2">
        content
    </div>
</div>
<script>
    const $ = document.querySelector.bind(document);
    const box1 = $('#box1');
    const box2 = $('#box2');
    
    box1.addEventListener('click', () => {
    console.log('box1 true');
    }, true);
    
    box1.addEventListener('click', () => {
    console.log('box1 false');
    }, false);
    
    box2.addEventListener('click', () => {
    console.log('box2 true');
    }, true);
    
    box2.addEventListener('click', () => {
    console.log('box2 false');
    }, false);
</script>
A.

box1 true, box2 true, box2 false, box1 false

B.

box1 true, box2 false, box1 false, box2 true

C.

box2 false, box2 true, box1 false, box1 true

D.

box1 true, box1 false, box2 true, box2 false

题目信息
校招真题
-
正确率
0
评论
15
点击