r/code • • Mar 11 '20

Code Question

I am going to be attending General Assembly and was working on the prework.

Here are my current instructions:

Next we'll add logic to check to see if two cards have been played, because in our final game we will not want to check for a match until the user has selected two cards.

  • Write an if
    statement that checks to see if the length of the cardsInPlay array is 2.

  • For the condition, you can use the length
    property to find out how many items are in the cardsInPlay
    array and then use the ===
    operator to see if the length is equal to 2.

I've got the first part of the if statement, but I am clueless on what they want for the rest of it. Next step is putting an if statement in the if statement...which wasn't hard or a problem. It's this that is making me stuck. Help?

0 Upvotes

3 comments sorted by

View all comments

3

u/[deleted] Mar 11 '20

I'm interpreting this as all one problem. They are introducing what needs to be done and then being more specific on how to get it done.

To me it seems like they want you just to write whatever is equivalent to this:

if(cardsInPlay.Length === 2)