![]() | |
#1
| |||
| |||
|
|
I'm new to JavaScript. So please excuse my mistakes. I need help on merging two arrays into a third one. There is an array a = {188, 180, 159, 67 } There is another array b={'Rio de Janeiro', 'Sao Paulo', 'Brasilia', 'Belo Horizonte'} |
|
How can I merge them to produce an array that is equivalent to this: bg.xValues[0] = [188,'Rio de Janeiro']; bg.xValues[1] = [180,'Sao Paulo']; bg.xValues[2] = [159,'Brasilia']; bg.xValues[3] = [67 ,'Belo Horizonte']; |
#2
| |||
| |||
|
|
Thanks for the reply. I tried the code you've posted without success I used for(i=0; i < a.length; i++) bg.xValues[i]=[a[i], b[i]]; and also for(i=0; i < a.length; i++) bg.xValues[i]=[eval(a[i]), eval(b[i])]; |
|
The bg object is a strange beast that expects atomic values like 145 or 'test'. Any thoughts? |
![]() |
| Thread Tools | |
| Display Modes | |
| |