Create variable name from an array value

Hi,

Please can you help me?
In javascript is it possible to create a var name from an array value?
(I will assign to that name the return value of a function)

I have this example, I want to create a var name from array_example[0][1]. Is it possible?:

   
[FONT=Courier New]array_example = new Array(new Array("value_0_0", "value_0_1"));

for (r = 0; r <= array_example.length - 1; r++) {
[INDENT]var array_example[r][1] = name_of_a_function();[/INDENT]
}[/FONT]


executing this code I should obtain:

[FONT=Courier New]var value_0_1 = return_value_of_a_function[/FONT]

many thanks.

I don’t think you can, but you can use the array value as the function name…


var value_0_1 = function() {
		alert('called value_0_1');
	},
	array_example = [["value_0_0", "value_0_1"]],
	r = 0;

for (r; r <= array_example.length - 1; r++) {
	var func = array_example[r][1];
		window[func]();
}