Created my JavaScript code for generating a schedule