I want to create an object from a list inside an array. I have an array which is dynamic and supposed to look like this:
var dynamicArray = ["2007", "2008", "2009", "2010"];
And I want to make an object like this with some JavaScript ES6:
const obj = {
    2007: {
        x: width / 5,
        y: height / 2
    },
    2008: {
        x: (2 / 5) * width,
        y: height / 2
    },
    2009: {
        x: (3 / 5) * width,
        y: height / 2
    },
    2010: {
        x: (4 / 5) * width,
        y: height / 2
    }
}
Don't worry about the inner objects. I just want to create a structure like this:
 obj = {
      2007: ...,
      2008: ...,
      ...
    }
Please help, thanks.
 
     
     
     
     
     
     
     
     
    