Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Maxim Melnic](https://uploads.teamtreehouse.com/production/profile-photos/10046302/micro_logo.jpg)
Maxim Melnic
4,178 Pointsvar card = [ranks[i], suites[l]];
Hi, i can use this method?
function createDeck() { var suites = ['♠︎','♣︎','♥︎','♦︎']; var ranks = ['Ace','King','Queen','Jack','10','9','8','7','6','5','4', '3','2']; var deck = []; // add your code below here: for (var l = 0; l < suites.length; l += 1) { for (var i = 0; i < ranks.length; i += 1) { var card = [ranks[i], suites[l]]; deck.push(card); ...
in video with solution
let card = []; card.push(ranks[i], suites[l]);
or this line var card = [ranks[i], suites[l]]; add array in array and in array? It's work but can there be a mistake in this?
1 Answer
![Daniel Phillips](https://secure.gravatar.com/avatar/5cfbf92b79d64308f33069b9184eb141?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Daniel Phillips
26,940 PointsUsing 'i' and 'I' as loop variables for nested for loops can be risky. As you mention, it would be easy to make a mistake. I suppose it is not much different from the use of 'i' and 'j' that is common. The biggest problem is that 'I' and '1' look very similar in some fonts. Try to make your code easy to read.