Hello everyone
how can i retrieve the contents of the corresponding object in the ‘initChp’ function
ObjChp =function(params){
this.nom = null;
....
}
ObjChp.prototype.constructor =ObjChp;
ObjChp.prototype.initChp =function(chp){
> get object content here
...
}
Thank you for your help
YC
i recommend against using this old approach of creating state-full objects with prototype.
use either
class Person {
constructor(name) {
this.name = name
}
sayHello() {
console.log(`hello ${this.name}`)
}
}
- treat objects as immutable and use functions to handle these objects:
const person = {name: "Gaston"}`
const sayHello = (person) => console.log(`hello ${person.name}`)
pro tip: I also recommen to use typescript
Thank you for your reply.
I will actually use classes.
For typeScript, I will see that later. For this to be serious, it would be necessary to resume the whole application with typeScript.
thanks again
YC