Computing desk | ||
---|---|---|
< November 9 | << Oct | November | Dec >> | November 11 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
I'm just learning Javascript and having a little difficulty instantiating anonymous objects with variable names that shadow those of the parent scope. Suppose you had something like this:
function example(parameters) { return parameters.foo + parameters.bar; } function test { var foo = 67; var bar = 163; // ...do something with foo and bar here, and then... var baz = example({ foo: this.foo, bar: this.bar }); // Error! }
What's the right syntax to do that sort of thing? Earl of Arundel (talk) 04:30, 10 November 2016 (UTC)
function test
. Within the test
function, this
refers to the Window
object, not the function itself, so this.foo
and this.bar
are both undefined
. If you just write var baz = example({ foo: foo, bar: bar });
then it should work as you expect. AndrewWTaylor (talk) 09:25, 10 November 2016 (UTC)
Do they exist? My experience with IPv6s is only with dynamic ones, where the same person is assigned to various IPs in a range of trillions or quadrillions of addresses, but I don't have significant amounts of experience. Nyttend (talk) 18:22, 10 November 2016 (UTC)
Devices implementing this specification MUST provide a way for the end user to explicitly enable or disable the use of temporary addresses, which means that there should be an option to get a static address (if you are using a fixed address point; I do not think there is a way to keep the same IPv6 on a mobile terminal that moves around).