Hej, jag ska göra ett kortspel med 52 kort i skolan som uppgift.
Kod:
Cards.prototype.shuffle = function () {
let deck = this.deck
let currentIndex = deck.length, temporaryValue, randomIndex
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex)
currentIndex -= 1
har skrivit denna kod men får dessa fel
Split initialized 'let' declarations into multiple statements detta fel visar att denna kod är det fel på
Kod:
let currentIndex = deck.length, temporaryValue, randomIndex
Expected literal to be on the right side of !== detta fel visar att denna kod är det fel på
Kod:
while (0 !== currentIndex) {
Kod:
} else {
result = console.log('YOU GOT BUSTED!!')
}
}
// Exports
Block must not be padded by blank lines detta fel dyker upp både på
Kod:
} else { <-- felmeddelande pekar på denna
} <-- felmeddelande pekar på denna
Vad kan felet vara på dessa?