0

I add properties to this function in this way and then I log the function to the console.

function x(){

}

    x.y = 5
    x.z = 10
    x.propertyTest = () => {
        return "this is the result"
}

console.log(x) returns { [Function: x] y: 5, z: 10, propertyTest: [Function] }

It seems that it is not putting these properties into the x function but instead is putting the x function and all the properties we added into an object and then automatically declaring this new object as the x function.

Is this what is happening?

Pointy
  • 405,095
  • 59
  • 585
  • 614
ooooohyesssss
  • 119
  • 1
  • 1
  • 7

0 Answers0