Hi, I’m simply trying to better relate, distinguish, and understand some general beginner terms in relation to the very first example here:
In regards to the definitions that I have read here:
Example:
console.log(31)
"METHOD"
Is “.log()” the method (action for the object “console” written before it?), and basically anything appending an instance with a dot operator + method name + parentheses is considered a method?
In the above example, the method puts to action the logging/printing inside the parenthesis (31) which we will then see in our console, correct?
"OBJECT"
Is anything in a line of code that has value or instructions considered an object?
In the above example, is “console” considered an object because it has internal data (instructions/is a Javascript keyword)?
And would “(34)” also be considered an object due to representing value?
I’m trying to understand if object is an interchangeable or perhaps synonymous label.
"INSTANCE" and "LIBRARY
“instance” has me confused when I read the “method” definition in:
It’s definition:
“Methods return information about an object, and are called by appending an instance with a period ., the method name, and parentheses.”
It’s example:
// Returns a number between 0 and 1
Math.random();
Since it says that you append an instance with a period etc., this tells me that it’s referring to “Math” as the instance.
So, is “Math” an object that is an instance, and is an instance because it is unique among a class of arithmetic that “Math” falls under?
In the same glossary below the “method” definition with the same example:
// Returns a number between 0 and 1
Math.random();
It defines Library as containing methods, while pointing out that “Math” is the library.
Not sure what I am asking here other than pointing out that “Math” seems to be referred to as an instance, an object, and a library. Please correct me if I am wrong.
String
Lastly, does “string” just refer to anything contained within the () parentheses of the method?
Sorry for the wall of text, I’m just trying to be as descriptive as possible in my confusion. I’ve gone further in the lessons but am reversing course to better understand the fundamental definitions and how they are applied and distinguished from each other in the examples.
Thank you so much.