Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling a JavaScript object class that's in a separate .js file

Tags:

javascript

I have created a string builder JavaScript object and I'm using it with many different .js files in my project.

Can I create this class in a separate .js file and call it from all the other scripts that instansiate it, just like a C# class file?

Is this possible, or do I continue copying and pasting it into the bottom of every .js file that uses it?

like image 852
JGilmartin Avatar asked Sep 05 '26 11:09

JGilmartin


1 Answers

Yes, this should not be a problem. Just include the .js files in the correct order in your html pages.

like image 100
Segfault Avatar answered Sep 07 '26 04:09

Segfault



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!