"with" scope and properties with square bracket notation
Posted
by Anurag
on Stack Overflow
See other posts from Stack Overflow
or by Anurag
Published on 2010-06-06T21:50:04Z
Indexed on
2010/06/06
21:52 UTC
Read the original article
Hit count: 214
Is it possible to access object properties that can only be accessed with the square bracket notation when inside a "with" statement.
Example:
var o = { "bad:property": 1, "goodProperty": 2 };
with(o) {
console.log(goodProperty); // works awesome
console.log(???) // how to access "bad:property"?
}
© Stack Overflow or respective owner