Upon first glance, it seems like the answer to my question is quite simple. However, I've been struggling to find the exact information I need when searching for help.
I have a good understanding of how to loop over a JSON array. What I'm looking for is a solution where I can use a variable following 'finaldataset[i]' instead of a specific key in the JSON data.
function iterateOverJSON(s){
for(var i = 0; i<finaldataset.length; i++){
console.log(finaldataset[i].s)
}
}
Imagine finaldataset as an array containing movies and various attributes about each movie. I want the function to accept a parameter, like "director" or "movieLength," to display the desired information. Any assistance would be greatly appreciated.