Pure Functions and Immutability in JavaScript