guys wats the use of these () on methods.for example b.Person(); | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

guys wats the use of these () on methods.for example b.Person();

parenthesis

23rd Dec 2018, 9:05 AM
Andrew
Andrew - avatar
3 Answers
+ 8
Since you are a beginner, read the first 2 links. As you gain more understanding on the topic, the 3rd link will be a no-brainer. https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2285/?ref=app https://www.sololearn.com/learn/Python/2286/?ref=app https://www.sololearn.com/learn/Python/2484/?ref=app
23rd Dec 2018, 10:28 AM
Lambda_Driver
Lambda_Driver - avatar
+ 2
I checked your progress and I believe you are at the third page of the lesson of class method of Javascript: https://www.sololearn.com/learn/JavaScript/1154/ 1. If so, can I suggest you, next time when you post question, add language as the tag of your question. 2. Class method is also a type of function, blank parathesis means you pass no arguments into the function. 3. Class method and class properties are defined in class. And called by the instance of the class. In the example in your question, b is the instance, and the method is called according to the class of b. 4. Can I suggest you, to click the "Try It Yourself" in the lesson, and play with the codes for while after entering code playground. You can try to create new instance and see what happens. And change the class methods and see what happens. 5. As an illustration, I am deleting the () of yearofbirth() in the document.write() and you can see that the code of the function is printed instead https://code.sololearn.com/WTbZt14tnCYf/?ref=app
23rd Dec 2018, 10:50 AM
Gordon
Gordon - avatar
0
man am a beginner wats a function
23rd Dec 2018, 9:44 AM
Andrew
Andrew - avatar