0
Why is it that some method have parenthesis and some are not having. Examples: int[] arr= new arr[] arr.length arr.append()
Array
3 ответов
+ 2
arr.length is data field.
arr.append() is a method.
When you have () in calling, then it is a method, otherwise it is a data.
Mention the language name, which you refering...
Also, it's possible to assign a function to a variable in some languages.
As far I remember, in js, When you assigning a function to a variable, it's not need to add parenthesis. If you add there, then it call the function instead of assigning or making a alias..
+ 1
If I may ask what is the use of the parenthesis
0
That makes a difference between it's data field and member method.
Or a simple variable and a function.. according to syntax.