So I want to create a dynamic key in a js object. I know I can create it like this but id doesn't fullfil my requirements
return {
[dynamicKey]: value
}
But the problem is I want something like this
return {
[dynamicKey]_id: value
}
but it doesn't let me, I tried concatenating but it didn't work.
return {
[dynamicKey] + '_id': value
}
I've also searched online for a solution but couldn't find any.
[dinamicKey + '_id']: value- the whole expression must be inside the square brackets.