3
TIP: The cards include all numbers except cards 8 and 9.
The reasoning I had at first was to create several arrays each with the suit name (spades, clubs, diamonds and hearts) and then use the FOR repeat command to return the string list. Until the end of this racicinio I found it quiet, but I (literally) enclosed in the FOR part and the exclusion of cards 8 and 9. Can anyone help me in this code using the simplest way to initiate? (I am learning alone and through the internet, patience rs).
In the FOR part I did this for each suit, however appear errors like: (naipeDeruco makes comparisons against strings) and naipeDeruco("swords") SHOULD NOT contain the "8 of spades" - naipeDeruco(...). indexof is not a Function //
I don’t really know how to solve this exercise even more than the error of comparisons against strings is already recurring in other exercises of conditionals that I did.
function naipeDeTruco(naipe){
let espadas = [];
let copas = [];
let ouros = [];
let paus = [];
for(var i=0; i <13; i++)
if(naipe === "espadas"){
naipe =[ i +" "+"de" + naipe] - [ 8 +" "+"de" + naipe] - [ 9 +" "+"de" + naipe];
return naipe;
}
}
You can give an example of what it is
naipe
and what you expect this function to return to?– Sergio
Suit is the name given to the "families" or types of playing cards (spades, clubs, diamonds and hearts). An example that is given is: naipeDeruco("swords") will return ["1 of swords", "2 of swords","3 of swords" ...,"12 of swords"]
– Stéphanie Verissimo
Okay, and no return King, Ace, Queen or Jack?
– Sergio
return a list of strings, one for each card of that suit following the cards of the truco. From what I understand in the question he asks all the cards of each suit but excluding the cards 8 and 9, so should enter yes King, Ace, Queen and Jack.
– Stéphanie Verissimo
What are their letters and orders? They must be returned in order of strength?
– Luiz Felipe
all cards contained in a suit except cards 8 and 9. They must not be returned in order of strength, the only restriction given is on cards 8 and 9. And by the given example goes up to 12 cards. (I’ve never played cards so I’m more confused)
– Stéphanie Verissimo