My first encounter with problems in JavaScript