Hi Nic,--1st question, On page 167, the only note says the prototype of a class is readonly, but I tried with following code, it works well,class PersonClass {constructor(name) {this.name = name;}sayName() {console.log(this.name);}}/* method or property could be assigned on the prototypesame as declaring class with function */PersonClass.prototype.anotherFunc = function () {console.log(this, 'another func');};PersonClass.prototype.age = 9;let person = new PersonClass('jeff');/* special note: for-in and getOwnPropertyNames are difffor-in only gets props on prototype, getOwnPropertyNamesonly gets instance attr */for (const key in person) {console.log(key);}console.log(Object.getOwnPropertyNames(person));2nd question, as my comments show, for-in only gets all the props on prototype of a class, and Object.getOwnPropertyNames only gets attrs on the instance. I am asking that cuz you probably know it and I couldn't find a good answer for that online.thx & brs,Jeff
You received this message because you are subscribed to the Google Groups "Zakas Books" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zakasbooks+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/zakasbooks/3d4271a6-f709-4a7b-a30d-d85844ab811c%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to zakas...@googlegroups.com.