Homework with JavaScript