We want to import the answer from the animal function to the if-stament- how do we do that?
const animal = (msg) => {
questionNumber++;
botReply(`Nice to meet you ${msg}. Do you like pandas, elefants or koalas?`);
inputWrapper.innerHTML = `
<button id="tiger">Tiger</button>
<button id="elefants">Elefants</button>
<button id="bears">Bears</button>
`;
document
.getElementById("tiger")
.addEventListener("click", () => nextQuestion("tiger"));
document
.getElementById("elefants")
.addEventListener("click", () => nextQuestion("elefants"));
document
.getElementById("bears")
.addEventListener("click", () => nextQuestion("bears"));
};
const showMenu = (type) => {
questionNumber++
questionNumber++;
botReply(`oh good choice ${type}? Do you like warm placese or cold?`);
inputWrapper.innerHTML = `
inputWrapper.innerHTML = `
<button id="cold">Cold</button>
`
`;
document
document
.getElementById("warm")
.addEventListener("click", () => nextQuestion("warm"));
document
.getElementById("cold")
.addEventListener("click", () => nextQuestion("cold"));
};
const showDishSize = (type, animal) => {
questionNumber++;
/* Elefant */
if (type === "warm" && animal === "elefants") {
botReply(
`oh good choice, you like warm weather and elefants! You should go to India!"`
);
} else if (type === "cold" && animal === "elefants") {
botReply(
`oh good choice, you like cold weather and elefants! You should go to China!"`
);
} else if (type === "warm" && animal === "tiger") {
/* Tiger */
botReply(
`oh good choice, you like warm weather and tiger! You should go to India!"`
);
} else if (type === "cold" && animal === "tiger") {
botReply(
`oh good choice, you like cold weather and tiger! You should go to Russia!"`
);
} else if (type === "warm" && animal === "bears") {
/* Bears */
botReply(
`oh good choice, you like warm weather and bears! You should go to Africa!"`
);
} else {
botReply(
`oh good choice, you like cold weather and bears! You should go to Sweden!"`
);
const showDishSize = (type, animal) => {
};
Thank you :)
Aucun commentaire:
Enregistrer un commentaire