I’m still very new to Javascript, and I was looking for some advice.
I have set up the a google maps view to my liking, however it uses an array built into the javascript itself. basically this….
var locations = [
[9.449062, 7.950439, 0],
[34.449062, 10.950439, 50]
];
Where the first two fields are location coordinates, and the third is a value I plan to use at another time.
I’ve looked at various tutorials, and they ever seem to not work with a local file (i.e. the fileis in the same directory on the filesystem), or the tutorial just does not seem to work.
I know there have been similar questions, however I can’t seem to find what works for me.
I was wondering if someone could help me understand how to use a JSON file as an array like above.
Thanks in advance all.
MHibbin
🙂
That looks like perfectly valid JavaScript assignment of object to variable. If you’re using them from HTML page, just include script with your data first and then processing script later:
Where locations.js is exactly like quote you’ve provided and worker.js is something along the lines: