Cannot create property on string
Empty Objects need to be individually created before their values are assigned. And use of const
is not a good idea here, anyway, it's just my suggestion.
const birthdays = {};
var day = 123;
var id = 21;
var birthday = 2016;
// Loop -> Passing day, id and birthday
birthdays[day] = {};
birthdays[day][id] = birthday;
I had a similar error message TypeError: Cannot create property 'false' on boolean 'false'
in Node 14.3.0 (ES 2019), using the new Javascript semicolon-less syntax, with a variable declaration and assignment followed by a destructuring assignment on the next line.
The code that caused the error:
var a = b ()
[c, d] = e ()
Solved by:
var a = b ()
;
[c, d] = e ()