JS经典计算。

<script>
/**
*经典计算
*/
var aaa ={
    n:1,
    valueOf:function(){
        return this.n++;
    }
};
console.log(
    aaa==1&&aaa==2&&aaa==3&&aaa==4&&aaa==5
);
/**
*经典计算++a和a++
*/
var a=1;
console.log(a++*(++a + a++));
/**
*经典计算中括号
*/
console.log(([][[]] +[])[+!![]] + ([]+{})[+!![] + +!![]]);
/**
*当T小于10,则补0
*/

t=2;
t = (t+1 > 10)?t*2:'0'+t*3;
console.log(t);

</script>

 

posted @ 2022-10-24 17:50  钢锅  阅读(21)  评论(0编辑  收藏  举报