Implement Inversion of Control

Share this video with your friends

Send Tweet

Inversion of Control is a simple principle that can drastically improve your reusable code. In this lesson we'll go over the concept and you'll get an idea of how you can apply it for your own abstractions.

This is based on my blog post: Inversion of Control

Daniel Deverell
Daniel Deverell
~ 5 years ago

Thanks for this. I will definitely be using inversion more in the future. Note to others: at the end of the video you probably want legCount set in the filterByLegCount function:

function filterByLegCount(array, legCount) {
  return filter(array, animal => animal.legs === legCount);
}
Chandrasekar Arunachalam
Chandrasekar Arunachalam
~ 5 years ago

Hello Kent,

Correct me if I'm wrong. To check undefined and null like this (element !== null && element !== undefined). Hope the following will work (element != null) this checks both undefined and null.