with 语句用于设置代码在特定对象中的作用域。
语法:
with (expression) statement
x = Math.cos(3 * Math.PI) + Math.sin(Math.LN10);
y = Math.tan(14 * Math.E);
with (Math) {
x = cos(3 * PI) + sin(LN10);
y = tan(14 * E);
}
像上面的代码,Math是对象,cos、sin、tan是它的值,如果没有with,就应该是Math.cos