I am wondering why "if (ethos[name])" is already enough? Coz I would write if(name=ethos[name]). What does it mean? Thank you.
var ethos = {
achilles: "glory",
aeneas: "duty",
hades: null // Beyond human understanding
}
function printEthos (name) {
if (ethos[name]) {
console.log(ethos[name]);
} else {
console.log(name + " has no recorded ethos.");
}
}```
Aucun commentaire:
Enregistrer un commentaire