I've been trying to understand a simple if else assignment from freecodeacademy. The following bit of code only seems to output 'Test' from the first if statement no matter what the input is. What am I doing wrong?
Code:
function cc(card) {
// Only change code below this line
if (card=7){
console.log('Test');
}
else if (card=8){
console.log('Test 2');
}
else {
console.log("Test 3");
}}
Sample output:
:cc(8)
:Test
:cc(7)
:Test
:cc('K')
:Test
Aucun commentaire:
Enregistrer un commentaire