There are two podlyuchaemyh js-file, each of which contains its own object, but they have the same names.

When I connect them to the page and create an instance, it will create a descendant of the first podlyuchennogo file.

I need to operate on the page with two different objects. Names can not change.

// path_to_script/obj1.js var TestObject = function() { // some code } // path_to_script/obj2.js var TestObject = function() { // some code } <script src="path_to_script/obj1.js"></script> <script src="path_to_script/obj2.js"></script> <script> var objectOne = new TestObject(); var objectTwo = new TestObject(); </script> 

  • add a minimal reproducible example . An example of the contents of the files, how you connect them and how you use them - Grundy
  • Here, inserted a sample code. The essence is stated in the post itself. - Maxim Dobrynin

0