Hi,
Can anyone please advise me on the following. Here I have a bunch of variables in an array. And then those arrays in another array. I want to assign values to those variables in arrays. Is this the correct way to do it?
Best regards
Can anyone please advise me on the following. Here I have a bunch of variables in an array. And then those arrays in another array. I want to assign values to those variables in arrays. Is this the correct way to do it?
Code:
<html>
<body>
<script type="text/javascript">
var a,b,c,d,e,f;
var set1=[a,b,c];
var set2=[d,e,f];
var comboAll=[set1,set2];
function initializeVars(){
for (var i=0; i<comboAll.length;i++){
for (var j=0; j<comboAll[i].length;j++){
comboAll[i][j] = 'Hello ' + j ;
}
}
document.write('Start wrting variables<br />');
document.write(a + '<br />');
document.write(b + '<br />');
document.write(c + '<br />');
document.write(d + '<br />');
document.write(e + '<br />');
document.write(f + '<br />');
}
</script>
</body>
<input type='button' value='Initilize' onClick='initializeVars();' />
</html>
Comment