I saw a source code and noticed there was an "additional" curly brackets around a.name as below, although the common case I usually see is without curly bracket.
I'm wondering this works differently in some specific cases, which I tried and came out the same though, or some sort of convention. Does anybody know the difference?
With curly bracket
array.forEach((item, index) => {
let a = {
id: index;
};
{
a.name = 'test';
}
}
Without curly bracket
array.forEach((item, index) => {
let a = {
id: index;
};
a.name = 'test';
}