freeCodeCamp/guide/chinese/certifications/javascript-algorithms-and-d.../basic-javascript/comparison-with-the-less-th.../index.md

407 B
Raw Blame History

title localeTitle
Comparison with the Less Than Operator 与小于算子的比较

与小于算子的比较

< Less Than是一个逻辑运算符它返回true左边的值低于右边的值。

基本解决方案

function testLessThan(val) { 
  if (val < 25) 
    return "Under 25"; 
 
  if (val < 55) 
    return "Under 55"; 
 
  return "55 or Over"; 
 }