When do i put my put my object in the parentheses and when before the method?


When do i put my object in the parentheses, and when before the method?
for ex fahrenheit = Math.floor(fahrenheit);
myName = ‘JOHN’.toLowerCase();
why do i put fahrenheit in the parentheses in the 1’st case scenario, and john before the parentheses in the 2’nd case scenario?


Math is a special JavaScript object that has several built-in methods to work with common mathematics functions. It also houses some of the more common constants such as PI and E.

'JOHN' is a string literal. a member of the String class, another built-in object class of JS. .toLowerCase() is a method of that class, as are several others, including .toUpperCase(), .substr, .substring, slice, etc.

Methods are functions that are written as properties of a class or object. Only instances of the class, or the object proper can access the methods.

Functions are methods of the window object, but we treat them as standalone functions that any part of the program can access.

function foo() {


The above function declaration may called anytime from anywhere in the program provided it (the function) is written in that scope or above (higher in the scope chain).

object = {
    foo() {


foo() is still a function, but as it is written as a property of object, only that object access it.