+ 5
My code
I am beginning web development in javascript and this is my first code using object programming. I defined a method without any arguments and I used 'this' in the method to refer to previously defined properties of the object. Is this the good way to do this? Are we allowed to use this inside the method? Thanks for any answer! https://code.sololearn.com/W21JaH79PL53/?ref=app
1 Réponse
+ 6
Oui, tu peux accéder au propriétés directement avec this, aucun problème. Mais tu peux tout autant créer une class, ce qui te sera plus facile.
English:
Yes, you can access properties with the this keyword, there's no problem. But you can easily do objects with the class keyword