I believe I understand If/else statements using operators and numbers but I am not quite understanding it when it comes to a choice???
For example: I have two variables, lovesIcecream and typeOfIcecream. My goal is using an if/else statement, assign lovesIcecream to true if typeofIcecream is 'Chocolate', assign it to false if it is 'Vanilla'. This I have so far.
if(typeOfIcecream = ???) {
lovesIcecream = true;
}else {
lovesIcecream = false;
I am not sure where to input 'Chocolate' and 'Vanilla' hence my question marks. I researched and studied javascript Control flow and if else statements by watching free videos online and it seems that I get the same examples which using numbers such as:
if(age >= 16) {
typeOfLicense = ('Full License')
}else {
typeOfLicense = ('None')
}
Anyways, If you can help me understand this and maybe suggest what I should be studying exactly to understand the 'typeOfIcecream' code better.
Aucun commentaire:
Enregistrer un commentaire