clean-code-javascript icon indicating copy to clipboard operation
clean-code-javascript copied to clipboard

Suggestions for "Don't write to global functions"

Open ajcrites opened this issue 8 years ago • 0 comments

Just a suggestion, but I think the example conflicts a bit with other philosophies espoused in this repo.

  • SuperArray. is not a descriptive name. DiffableArray or something like that may be better.
  • I can't find any concrete resources on this, but I think that extending global objects like Array should be avoided. I could be totally off base about this perspective, though.
  • Additionally, from the perspective of favoring functional programming as well as JavaScripts ability to have global functions I think a diffArray(array, compareToArray) would be more appropriate here. It seems like future sections expand on this a little bit more, but I don't think the goal of this document is to provide progressive information.

ajcrites avatar Jan 12 '18 17:01 ajcrites