• 主打的就是一蠢


    123

    var x = "abc"; // 不清楚x的用途
    
    function a(b, c, d) {
      // 一堆未注释的代码...
      // ...
    }
    
    // 混合使用单引号和双引号
    var message = "It's a beautiful day!";
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    fetch("https://xxx/api/data")
      .then(response => response.json())
      .then(data => {
        // 未处理可能的网络或解析错误
        console.log(data);
      });
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    // 地狱级回调
    let play = function(){
      this.installBox();
      this.step1(function(){
        this.step2(function(){
          this.step3(function(){
            this.step4(function(){
              this.step5(function(){
                this.step6(function(){
                  this.step7(function(){
                    this.step8(function(){
                      this.step9(function(){
                        this.stepN(function(){
                          // N + 1 ......
                        });
                      });
                    });
                  });
                });
              });
            });
          });
        });
      });
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    // 毫无意义的if语句
    return kRegex.test(value);
    
    if (kRegex.test(value)) {
      return true;
    } else {
      return false;
    }
    
    if (userAge >= 18) {
      if (userAge <= 65) {
        // 如果用户年龄大于等于18且小于等于65,执行某些操作
      } else {
        // 如果用户年龄大于等于18但大于65,执行某些操作
      }
    } else {
      // 如果用户年龄小于18,执行某些操作
    }
    
    
    if (x > 42) {
    // 魔法数值 42
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    // Zhuangbility 
    // Boolean
    !!'fuck'
    
    // ParseInt
    ~~3.14159 === parseInt(3.14159)
    
    // 十六进制
    (~~(Math.random()*((1<<24)-1))).toString(16)+'00000').substring(0,7)
    
    // <<
    parseInt('1000000000000000000000000', 2) === (1 << 24)
    Math.pow(2,24) === (1 << 24)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    // switch 判断冗余
    let startDay = 0 
    let endDay = 1  
    switch (query.birth) {
        case  '0~1' :  //当天过生日
          startDay = 0
          endDay = 1
          break
        case  '1~8' :  //1~8天过生日
          startDay = 1
          endDay = 8
          break
        case  '8~16' :  //8~16天过生日
          startDay = 8
          endDay = 16
          break
        case  '16~31' :  //16~31天过生日
          startDay = 16
          endDay = 31
          break
        case  '31~999' :  //31天以后天过生日
          startDay = 31
          endDay = 999
          break
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    // 每个判断都要执行一次
    if (productClass ===  Card  && action === BUYCARD) {
      seneca.sendSms(smsData, params)
    }
    if (productClass ===  Card  && action === TURNCARD) {
      seneca.patchStatus(productId)
    }
    if (productClass ===  Card  && action === REPLACE) {
      seneca.changeStatus( crm ,  Card )
    }
    if (productClass ===  Lesson ) {
      seneca.changeStatus( course ,  Lesson )
    }
    ...
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
  • 相关阅读:
    kubernetes Auditing 实战
    端到端语音识别笔记
    【四:Unittest框架】
    计算机毕业设计Java计算机office课程平台(源码+系统+mysql数据库+lw文档)
    【LearnOpenGL基础入门——2】搭建第一个OpenGL窗口
    Linux内核中的锁
    SpringCloudAlibaba【二】整合Nacos
    Windows【工具 04】WinSW官网使用说明及实例分享(将exe和jar注册成服务)实现服务器重启后的服务自动重启
    嵌入式Linux应用开发-基础知识-第十八章系统对中断的处理①
    数据结构-堆排序
  • 原文地址:https://blog.csdn.net/qq_43775179/article/details/133924477