I have a JSON file with gallery of images inside. I am extracting that data with a function , but i want , once that data is extracted to store it into a variable , so that from now on i can use that variable for data reference. How can i do that
function getJsonphotos() {
$.getJSON("./json/photos.json", displayImages);
}
function displayImages(data) {
data.forEach(function (item) {
storeContainer.append(`<<img id=${item.id} src=${item.location} />)
});
let jsonArrayVariable = [] ;
How should i place the photos in the jsonArrayVariable
variable.