Javascript compare 3 values

后端 未结 7 2414
执笔经年
执笔经年 2020-11-29 11:04

I have 3 values that I want to compare f, g and h. I have some code to check that they all equal each other and that none of them are null. I\'ve had a look online but could

7条回答
  •  没有蜡笔的小新
    2020-11-29 11:28

    Create an array of string and check the existance of next value in there

    compareAnswers(a1: string, a2: string, a3: string): boolean {
       this.compareAnswerArr.push(a1);
    if (this.compareAnswerArr.includes(a2) == false) {
      this.compareAnswerArr.push(a2);
      if (this.compareAnswerArr.includes(a3) == false) {
        return true;
      } else return false;
    }
    else return false;}
    

提交回复
热议问题