![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
i want the key of a hash to be based on a variable: i tried: var c = 'blah'; var arr = { 'a':1000, b:2000, c.valueOf():3000 }; also var arr = { 'a':1000, b:2000, c.toString():3000 }; why not? |
|
it seems none of this is allowed. is there a way to do this? |
#3
| |||
| |||
|
|
var arr = {}; arr['a'] = 1000; arr.b = 2000; arr[c] = 3000; |
#4
| |||
| |||
|
|
is there a way to do this? var arr = {}; arr['a'] = 1000; arr.b = 2000; arr[c] = 3000; |
#5
| |||
| |||
|
|
On Dec 14, 6:59 am, Peter Michaux <petermich... (AT) gmail (DOT) com> wrote: is there a way to do this? var arr = {}; arr['a'] = 1000; arr.b = 2000; arr[c] = 3000; Or even arr[f()] = 4000; given that f is a function returning a valid PropertyName |
![]() |
| Thread Tools | |
| Display Modes | |
| |