Various exercises in JavaScript