Complete Javascript assignment