DEV Community

Discussion on: Understanding Dependency Injection in JavaScript

Collapse
 
tanth1993 profile image
tanth1993

many thanks. I've read about "Dependency inversion principle" and I know it clearly after reading your article.
Even though JS doesn't have interface, this is a good, clear and simple example.
in JS files, I usually use export and import some functions into a module, so is it the way could replace DI?

Collapse
 
_mohanmurali profile image
Mohan Murali

Yes, you dont really need to create class objects to use funtions in js. You can directly use functions in most of the case. Glad you liked it.