| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 | <!DOCTYPE html><html lang="en"><head>  <meta charset="UTF-8">  <meta http-equiv="X-UA-Compatible" content="IE=edge">  <meta name="viewport" content="width=device-width, initial-scale=1.0">  <title>Document</title>  <style>    #div1 {      width: 200px;      height: 200px;      background: orange;    }  </style></head><body>  <div id="div1"></div>  <script>    //需求 点击div 2s延迟时间  然后变为粉色    /* var div1 = document.getElementById('div1')    div1.onclick = function(){      //保存this的值      // let _this = this      // setTimeout(function(){      //   _this.style.background = 'pink'      // },2000)      setTimeout(()=>{        this.style.background = 'pink'      },2000)    } */    //需求2  从给定的数组里面返回偶数的元素    // const arr = [1, 6, 7, 10, 100, 25]    // // const result = arr.filter(function(item){    // //   if(item % 2 ==0){    // //     return true    // //   } else {    // //     return false    // //   }    // // })    // const result = arr.filter(item => item % 2 == 0)    // console.log(result)  </script></body></html>
 |