提问人:Noobtotal 提问时间:6/7/2023 最后编辑:AlanNoobtotal 更新时间:6/7/2023 访问量:39
在 javaScript 中使用比较表达式丢失
lost with comparison expression in javaScript
问:
我正在做一个挑战,我已经得到了解决这个问题,但我找不到错误。
声明一个名为 speed 的变量,并将其设置为等于 90。
然后声明一个名为 busExplodes 的第二个变量,并为其赋值 检查速度是否小于 80.
将结果打印到控制台。
var speed = 90;
var busExplodes = 80 < 90;
console.log (busExplodes);
我收到此错误:>>>>Code is incorrect Your condition should evaluate if speed is lesser than 80.
我做错了什么?
答:
0赞
JIAN SHI
6/7/2023
#1
您可以使用以下 JavaScript 代码完成此任务:
// Declare a variable named speed and set its value to 90
let speed = 90;
// Declare a second variable named busExplodes and assign it the result of a comparison expression that checks if speed is less than 80
let busExplodes = speed < 80;
// Print the result to the console
console.log(busExplodes);
评论
var busExplodes = speed < 80;
speed