Javascript File - namespace, class, Component, what is it?

Something i have been having a hard time wrapping my head around , is exactly what is the file itself denoting. The reason im slightly confused is because, for eg, inside of a single javascript file i write this …

class classOne {

}

class classTwo extends classOne{

}

Now lets say i have two different javascript files, but neither declares a class inside , but instead, has all the same data that you would find in classOne , and classTwo respectively to each file. I have found no way to extend one javascript file from another. Sure i can create an instance of it , or access static variables directly, Which is why i thought , it a class or … Im confused, again, haha.

Thanks ~Will.

By default a UnityScript script with no class declaration in it is the same as explicitly typing out:

//MyClass.js
class MyClass extends MonoBehavior{
    //stuff goes in here
}

So to extend it you would create another file:

//MyClassExtension.js
class MyClassExtension extends MyClass{

}

Ahh , simple enough. Thanks :slight_smile: