How to pass a variable to an array key where the array is an another variable that is inside a curly bracket. In the following code I'm trying to push values from source array if the value is greater than 50.
render(){
var source_arr = [35,45,50,60,20];
var dest_array = [];
for(var x=0; x<source_arr.length; x++){
if(source_array[x]>50){
dest_array.push({source_array[x]});
}
}
return(
<div>
</div>
)
}
Here I'm not able to pass the value of variable 'x' as the array key inside the for loop.