Where are the methods stored?
Are the methods properties that are automatically added to each file type?
For example, does a string automatically inherit certain properties (methods like toUpperCase(), length property…) like a constructor does in a class?
Are the file types (strings, numbers, booleans…) also objects with properties?
I ask because the use of a period in front of the methods as if you were accessing an object.
Thank You for fast answer!
For example numbers and booleans?
Woops, technically a string is actually a primitive type, though it still has ‘built in’ methods like an object.
Arrays are objects though.
You’re asking good questions! freeCodeCamp does teach a bit about prototypes in later lessons, but since you’re already curious I encourage you to google around and find a description that makes sense to you.
Here’s one that is neat because it has some interactive code widgets:
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.