Jeff Mc
Jeff Mc

Reputation: 3793

Javascript with() performance

I remember reading quite a while ago that with() has some serious performance impacts in JavaScript due to its possibly non-deterministic change to the scope stack. I am having difficulty finding any recent discussion of this. Is this still true?

Upvotes: 3

Views: 747

Answers (1)

cgp
cgp

Reputation: 41381

It's not so much that with has performance impacts as it is just inadvisable. See also.

For the record, it's deterministic from the browsers perspective, but not the developer who needs to place a lot more trust than usual in the context of the variable.

Upvotes: 4

Related Questions