Indicators for Impurity

  • void functions
  • Accessing (global) mutable state
  • Date/Time functions (Date, setTimeout, setInterval, ...)
  • Clock-based functions (Math.random, UUIDs, ...)
  • Exception Handling (try-catch-finally)
  • I/O (console.log, file-io, ajax-calls, rest-calls, ...)

Mutating Array Functions

  • copyWithin()
  • fill()
  • sort()
  • reverse()
  • pop()
  • push()
  • shift()
  • unshift()

All other Array Functions are non-mutating