Let's say I have the following array: ['product' , 'model', 'version']
And I would like to have an object such as:
{
product: {
model: {
version: {
}
}
}
}
However, that array is dynamic so it could have 2, 3 or fewer more items. How can this be achieved in the most efficient way?
Thanks