All Solid Principles Javascript Interview Coding Question