Still not sure what you are trying to accomplish...
Code:
<!DOC HTML>
<html>
<head>
<title> Untitled </title>
<script type="text/javascript">
// do you mean this
var var1 = 'abc';
var var2 = 'def';
alert('var1+var2 = '+var1+var2);
// or do you mean
var var12 = var1 + var2;
alert('var12 = '+var12);
// or are you trying to do something like this...
window[var1+var2] = var1+var2;
alert('abcdef = '+window[var1+var2]);
// finally, this...
window['var12'] = var1+var2;
alert(window['var12']);
// or something else???
</script>
</head>
<body>
</body>
</html>
In this particular test of yours I would recommend accessing the variables via the arguments object instead:
Code:
function test()
{
var i;
for (i = 0; i < arguments.length; ++i) {
alert('The object: ' + arguments[i] + ' is stupid');
}
}
test('one', 'two', 'three');
In this particular test of yours I would recommend accessing the variables via the arguments object instead:
Code:
function test()
{
var i;
for (i = 0; i < arguments.length; ++i) {
alert('The object: ' + arguments[i] + ' is stupid');
}
}
test('one', 'two', 'three');
Bookmarks