Lets say that I have some array, and I need to go through every element store it in var and print it then. Which of these 2 ways is better in terms of memory efficiency, speed? First way:
var arr=[x,y,z];
for(var i=0; i<arr.length; i++){
var x=arr[i];
console.log(x)
}
Or second way:
var arr=[x,y,z];
var x;
for(var i=0; i<arr.length; i++){
x=arr[i];
console.log(x)
}