with就是为了减少代码
<script language="javascript" type="text/javascript">
x = Math.cos(3 * Math.PI);
alert("没有使用with:"+x);
with (Math){ y = cos(3 * PI);}
alert("没有使用with:x"+x+"使用with:y"+y);
</script>
js with
最新推荐文章于 2024-07-18 10:10:43 发布
with就是为了减少代码
<script language="javascript" type="text/javascript">
x = Math.cos(3 * Math.PI);
alert("没有使用with:"+x);
with (Math){ y = cos(3 * PI);}
alert("没有使用with:x"+x+"使用with:y"+y);
</script>