Why assign a method directly to an object without changing the object's reference?

c = {};
c = function(){console.log(444)};
c.g = 4

clipboard.png
Why is it okay to add properties to an object after assigning a method directly to the object? The quote hasn"t changed? Very strange-sharp-sharp-sharp topic description

sources of topics and their own ideas

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Oct.20,2021

Function is a reference object. Why can't attributes be added

var c = function(a, b){};
c.g = 4;
console.log(c.length)//2
console.log(c.g)//4
The

reference has changed. It's just that the function is also an object , so it's OK to add a c attribute to the object; similarly, you can also add a c attribute to an array


do not know that everything in js is an object, you don't have to declare a function directly and add an attribute in the first step, and the result is the same

.
Menu