My array.push is not working inside the function with preventDefault()
var correct = [];
function Drop(e){
e.preventDefault();
if(e.target.id === "images"){
correct.push("testID"); //this part is not pushing
console.log(correct); // it is showing here
}
}
console.log(correct); // not showing here , its empty
But outside the function , the array is not showing
Anyone encountered this?