Too Long; Didn't Read
Dependency Injection to Make Your Code Testable [A How-To Guide] is a simple technique to make your code easier to test. The W3Schools technique is called dependency injection. It lets the developer use a function to pass its dependencies through arguments. The technique is a pretty straightforward yet incredibly powerful technique. Let’s say you want to write a JavaScript function that can parse individual cookie key-value pairs out of the JavaScript code. For example, here is how to do this: getCookie (cookieName)