js isnull 赋值方法

<script>
var b = 'test';
var a = b || {};
alert(a)
</script>

结果:test

 

<script>
var b;
var a = b || {};
alert(a)
</script>

结果:object

posted on 2015-09-19 09:12  扭头撞到墙  阅读(527)  评论(0编辑  收藏  举报