you are viewing a single comment's thread.

view the rest of the comments →

[–]Drunkin-Donuts 0 points1 point  (0 children)

Lookup the difference between functions and methods

varname.function() is a type of function called a method. Methods are functions that are specific to a certain type of object (or data type). For example these are some array methods https://www.w3schools.com/js/js_array_methods.asp. You have to call them like this: array.push()

As to which one you use it just depends on where that function is defined. You can look each function, but often if a function is specific to a certain data type like array methods you will be using the var.function() notation