Why does console.log() shows A and not B? How do I get it to show B from the variable set in the if statement when the #input changes value?
var myNumber = 1;
var myLetter = 'A';
if( myNumber == 1 ){
myLetter = 'B';
}
$('#input').change(function(){
console.log( myLetter );
});
Aucun commentaire:
Enregistrer un commentaire