3 ms·
And this behavior is totally obvious (not) var id = 123; function updateOptionalProperty(obj) { with (obj) { id = 456; } } updateOptiona
by ben_alman 14y ago
And this behavior is totally obvious (not)
var id = 123;
function updateOptionalProperty(obj) {
with (obj) {
id = 456;
}
}
updateOptionalProperty({id: 0});
id // 123
updateOptionalProperty({});
id // 456
- bmuon 14y agoI actually ran into code once that had a variable named "position" (totally common name) and then used "with" on a node's style property to set another style based on the value of this "position" variable. Instant bug. It took me a while to figure out what was going on.