I basically understand, hasOwnProperty method in JavaScript is used to check whether the object has the specified property as its own property.
But the behaviour I checked in browser console below got me downright confused. Can someone explain me why this is happening. I did try finding existing answer, but couldnt find a relevant link.
If you check the typeof Shape it will return you a "function" but typeof s will return "object"
When you call var s = new Shape(); Shape will considered as class but name and size are members of Shabe class.
Default constructor will called on new Shape() and creates a object of Shape.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.