with()的用法 用户8859657861588 2022-01-06 118 阅读1分钟 with 语句通常用来缩短特定情形下必须写的代码量。在下面的例子中,请注意 Math 的重复使用: x = Math.cos(3 * Math.PI) + Math.sin(Math.LN10); y = Math.tan(14 * Math.E); 当使用 with 语句时,代码变得更短且更易读: with (Math) { x = cos(3 * PI) + sin(LN10); y = tan(14 * E); }