【JavaScript编程知识】JavaScript中条件语句的优化技巧总结.docxVIP

  • 3
  • 0
  • 约5.76千字
  • 约 12页
  • 2021-11-24 发布于湖北
  • 举报

【JavaScript编程知识】JavaScript中条件语句的优化技巧总结.docx

PAGE PAGE 1 JavaScript中条件语句的优化技巧总结   对多个条件使用 Array.includes   function test(fruit) {   ?if (fruit == apple || fruit == strawberry) {   ?console.log(red);   ?}   }   上面的例子看起来不错。然而,如果还有更多红颜色的水果需要判断呢,比如樱桃和小红莓,我们要用更多的 ||来扩展这个表述吗?   我们可以用 Array.includes 重写上面的条件!   function test(fruit) {   ?const

文档评论(0)

1亿VIP精品文档

相关文档