Closed towergame closed 4 years ago
@Passiday this completes task 3 in projects I suggest we move that card to "in progress"
case 1: return "A" + this.getSuitSymbol();
here and in other places replace with static constants for readibility (see CukasGame)
Is this what you had in mind?
case 1: return "A" + this.getSuitSymbol();
here and in other places replace with static constants for readibility (see CukasGame)Is this what you had in mind?
Yes exactly
@Passiday this completes task 3 in projects I suggest we move that card to "in progress"
@towergame you can do that too since you are a contributor (i think)
Nope, no permission to edit
toString() ir īpaša metode, ja objeto piespiež (coerce) konvertēties uz string (piemēram, obj+""), tad tiek netieši pasaukta objekta toString() metode. Tāpēc es sagaidītu, ka tiek izmantots array.join(", "), nevis mahinē ar paštaisītu ciklu.
Njaa, taa iznaak smukaak. Es arii pie viena izdomaaju uztaisiit log() CardSetam, ceru ka labi izskataas jo vajadzeeja kaartiigi palauzt galvu kaa lai panaak ka izmet console tiesi taa, kaa vajag.
Baigi sarežģītais Tev tas log() tomēr. Var taču vienkārši replace visus sarkanos simbolus ar "%c$&%c", pievienot array tik reizes, cik matchi, divus elementus - "color:red", "color:black" -, un tad pasaukt console log, izmantojot array spread operatoru (var, protams, ar apply, bet ar spread ir coolāk):
let params = ["color:red", "color:black", "color:blue"];
console.log("%cRed %cBlack %cBlue", ...params);
Vajadzeetu tagad buut smukaakam.
Vispār jau array push() metode pieņem n parametrus, bet Ok :)
Also fixed the toString() method in Card class, since I forgot how cards work.