// Pure: returns new array
const pureAdd = (arr, item) => [...arr, item];
// Impure: mutates original
const impureAdd = (arr, item) => { arr.push(item); };Pure functions avoid mutating arguments β return new values instead.
Learn to identify pure functions by checking whether they modify their inputs or depend on external state.
Challenge: Create a pure version of array transformation. Given an array, return a new array with each element doubled without modifying the original.