Is there a way to set multiple things in an If statement? For example in the below code, I want to set both status and icon variables if something is true or false. This code is not working and I'm suspecting it's because && doesn't compute, but couldn't find a solution. Any suggestions?
var status;
var icon;
if(x.life > 0) {
status = "Yes" && icon == "fa-check-circle-o"
} else {
status = "No" && icon == " fa-times-circle-o"
}
Aucun commentaire:
Enregistrer un commentaire