Ask EchoJS: Why isn't the `with` statement used more often?
▼4 up and 0 down, posted by
4 up and 0 down, posted by
The `with` statement [1] allows code execution in the scope of an object that we pass to it. ``` with (window.performance.timing) { console.log(loadEventEnd - navigationStart); } ``` Doesn't this make things simpler? Other than the reasons stated on MDN, are there any more serious problems? [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/with