What I am trying to do is dynamically add the URL of each image to an array whenever the user clicks a picture. I tried using the array method push() to add an image URL to an empty array but all it does is replace whatever image URL is already there with the new one you click.
$("img").on("click", function () {
event.preventDefault()
console.log(this);
const gif = $(this).attr("src");
let savedGif = []
savedGif.push(gif)
console.log(savedGif)
})