so easily. All variables must be declared with a type. JS is not statically typed unless you’re using a language, tool such as Typescript or Flow that compiles to JS code.
is run the compiler/interpreter will see your variable and its value then decide what type it is. The type is still enforced here, it just decides what the type is.
when you’re trying to access a method on a primitive and behind the scenes, it will use the constructor to make an object out of your primitive. Once it runs the method that object is then garbage collected. ( Removed from memory )