JS 定义的全局变量与函数的参数不要一样,系统不知道取哪个值显示

如下定义的全局变量var order_type = 0;,然而函数参数也有order_type,这种情况系统不知道取哪个值显示,平时一定要注意,谨记。

<script type="text/javascript">

var order_type = 0;
apiready = function() {
  other_first_order_message(6);
}

function other_first_order_message(order_type){
  alert(order_type);
}

</script>

转载于:https://www.jianshu.com/p/64b193949150

猜你喜欢

转载自blog.csdn.net/weixin_34233421/article/details/91072231