javascript and slice and dice homeworks