Bedtime story in javascript