var temp = new Array(); temp["abc"] = "abcd"; temp[1] = 2; temp[8] = 3; temp[2] = ""; // temp[2] = null; // temp[2] = undefined; // for (var t in temp) { // alert(t);//循环弹出 abc 1 8 2 不会弹出其他的(比如说3) // } // alert(temp["abc"]);//弹出abcd // alert(temp[3]); //弹出undefined if (temp[2]) {//temp[2]不是null 或者不是“”或者是0或者不是undefined时 会弹出 否则弹出456 此时 456被弹出 alert(123) } else { alert(456) } if(null==undefined){//正确 alert(123) }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
  • 2021-11-06
  • 2021-06-20
猜你喜欢
  • 2021-11-16
  • 2021-08-02
  • 2022-12-23
  • 2021-07-03
  • 2021-06-19
  • 2022-03-07
  • 2022-12-23
相关资源
相似解决方案