main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
let gameOfHope = [
  '29. Woman',
  '19. Tower',
  '27. Letter',
  '20. Garden',
  '35. Anchor',
  '03. Ship',
  '13. Child',
  '09. Bouquet',
  '30. Lily',
  '28. Man',
  '16. Star',
  '05. Tree',
  '32. Moon',
  '01. Rider',
  '18. Dog',
  '24. Heart',
  '17. Stork',
  '04. House',
  '31. Sun',
  '02. Clover',
  '12. Birds',
  '33. Key',
  '08. Coffin',
  '26. Book',
  '10. Scythe',
  '22. Crossroad',
  '34. Fish',
  '25. Ring',
  '36. Cross',
  '23. Mice',
  '21. Mountain',
  '14. Fox',
  '15. Bear',
  '11. Whip',
  '07. Snake',
  '06. Clouds'
]

let r = [
  'A',
  '2',
  '3',
  '4',
  '5',
  '6',
  '7',
  '8',
  '9',
  '10',
  'J',
  'Q',
  'K'
]

let ranks = [
  'Ace',
  'Two',
  'Three',
  'Four',
  'Five',
  'Six',
  'Seven',
  'Eight',
  'Nine',
  'Ten',
  'Jack',
  'Queen',
  'King'
]

let pip = [
  '♠',
  '♥',
  '♦',
  '♣'
]

let suits = [
  'Spades',
  'Hearts',
  'Diamonds',
  'Clubs'
]

let cardCounted = 1

let deckofcards = []

suits.forEach(function(suit) {
  r.forEach(function(item) {
    if (item === '10') {
      item = '0'
    }
    console.log(item + suit[0])
    deckofcards.push(item + suit[0])
  })
})

pip.forEach(function(p) {
  r.forEach(function(item) {
    console.log(item + p)
  })
})

suits.forEach(function(suit) {
  ranks.forEach(function(rank) {
    console.log(`${cardCounted}: ${rank} of ${suit}`)
    cardCounted++
  })
})
Native Browser JavaScript