我会把这个张贴在论坛在Udacity,但课程尚未正式开放给新的队列。我想知道你能不能帮我做一下我参加的测验的下面这个问题。以下是方向:
说明:冰淇淋是地球上最多才多艺的甜点之一,因为它可以用多种不同的方式来完成。使用逻辑运算符,编写一系列复杂的逻辑表达式,只有在下列条件为真时才会打印:
如果香精被设置为香草或巧克力,如果容器设置为圆锥形或碗形,如果配料设置为洒或花生(如果上述条件属实),则打印出:
我想要两勺__________冰淇淋,加__________的__________。用冰淇淋、容器和配料的味道填空。例如,
我想要两勺加花生的香草冰淇淋。提示:确保用不同的值测试代码。例如,
如果味道等于“巧克力”,容器等于“圆锥形”,而配料等于“洒”,那么“我想要两勺巧克力冰激凌装在一个洒在一起的圆锥体里。”应该打印到控制台。
这是我的代码,不应该将任何内容打印到控制台:
var flavor = "strawberry";
var vessel = "cone";
var toppings = "cookies";
// Add your code here
if (flavor === ("vanilla" || "chocolate") && (vessel === 'cone' || 'bowl') && toppings === ("sprinkles" || "peanuts")) {
console.log("I\'d like two scoops of " + flavor + " ice cream in a " + vessel + " with " + toppings + ".");
}我收到了一条错误消息:
您的代码应该有一个可变的样式-您的代码应该有一个可变容器-您的代码应该有一个可变的说明-您的代码应该有一个if语句-您的代码应该使用逻辑表达式。
出了什么问题
我在这里不知所措,任何帮助都将不胜感激。谢谢。
发布于 2019-01-09 20:39:44
发布于 2021-07-23 11:37:22
var flavor = "strawberry";
var vessel = "cone";
var toppings = "cookies";
// Add your code here
if (flavor === "vanilla" || flavor === "chocolate") &&
(vessel === "cone" || vessel === "bowl") &&
(toppings === "sprinkles" || toppings === "peanuts")) {
console.log("I\'d like two scoops of " + flavor +
" ice cream in a " + vessel + " with " + toppings + ".");
}https://stackoverflow.com/questions/54117928
复制相似问题