This is a sample of my Javascript code below. The main reason why I am writing this post is because I have a question about the last function, which is my GalleryImage function. There are four string variables inside that function. In each variable, I am supposed to store an element from the correspoding key in my JSON file's array. How do I do that? Underneath my javascript code is a sample of my JSON file code.
function GalleryImage(mJSON) {
var locate = "";
var description = "";
var date = "";
var url = "";
//implement me as an object to hold the following data about an image:
//1. location where photo was taken
//2. description of photo
//3. the date when the photo was taken
//4. either a String (src URL) or an an HTMLImageObject (bitmap of the photo. https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement)
}
"images": [
{
"imgPath": "img/places/australia.jpg",
"imgLocation": "Australia",
"description": "Loch Ard Gorge",
"date": "01/01/2016"
},
{
"imgPath": "img/places/austria.jpg",
"imgLocation": "Austria",
"description": "Austrian chapel",
"date": "01/02/2016"
}
]
}