Slice Method In String Javascript Functions With Parameters