recently read in js books that when defining variables that will be used to store objects, it is recommended to pay an initial value null, to indicate an empty object, which is not a big problem, but in practical business applications, it is often required to take an attribute of the object to do the assignment operation (such as data processing after a successful network request):
let obj = null,
peopleName = "";
peopleName = obj.name;
A syntax error: Cannot read property "name" of null
is reported, but this will not happen if the initial value of obj is assigned to {}.
so isn"t it impractical to assign initial values to null?