Client-side functions in JavaScript