[jQuery] Re: add property name via a variable

2008-11-15 Thread klkmva
Something like : -- function foo(x) { window[x] = 1; } foo('bar'); alert(window.bar); On 15 nov, 19:24, Johnnie Walker [EMAIL PROTECTED] wrote: Hi, Is there any way to add a property named via a variable to a javascript object?

[jQuery] Re: add property name via a variable

2008-11-15 Thread Theodore Ni
Something like this would work: foo(bar); function foo(prop) { window[prop] = 1; } Ted On Sat, Nov 15, 2008 at 1:24 PM, Johnnie Walker [EMAIL PROTECTED] wrote: Hi, Is there any way to add a property named via a variable to a javascript object? this is what I would like to do: