I have the following array
const lastThreeYearsArr = [currYear, currYear-1, currYear-2 ]
I need to define an object as:
var obj = {lastThreeYearsArr[0]: 0, lastThreeYearsArr[1]: 0, lastThreeYearsArr[2]: 0};
But using the array as key doesn't seem to work in javascript. Is there a way to access the array value and put it as key in the object.